python-portend/python-portend.spec
2023-07-07 02:35:17 +08:00

144 lines
5.8 KiB
RPMSpec

%global _empty_manifest_terminate_build 0
Name: python-portend
Version: 3.2.0
Release: 1
Summary: TCP port monitoring and discovery
License: MIT
URL: https://pypi.org/project/portend
Source0: https://files.pythonhosted.org/packages/8f/fc/bcfc768996b438d6e4bde7a6c8cfd62089847b0f5381a0e0ec2d8ee6b202/portend-3.2.0.tar.gz
Patch0000: Add-version-fix-no-version-in-build-product.patch
BuildArch: noarch
Recommends: %{name}-help = %{version}-%{release}
Requires: python3-tempora
Requires: python3-sphinx
Requires: python3-pytest
Requires: python3-pytest-checkdocs
Requires: python3-pytest-flake8
Requires: python3-pytest-black-multipy
Requires: python3-pytest-cov
%description
Use portend to monitor TCP ports for bound or unbound states.
For example, to wait for a port to be occupied, timing out after 3 seconds::
portend.occupied('www.google.com', 80, timeout=3)
Or to wait for a port to be free, timing out after 5 seconds::
portend.free('::1', 80, timeout=5)
The portend may also be executed directly. If the function succeeds, it
returns nothing and exits with a status of 0. If it fails, it prints a
message and exits with a status of 1. For example::
python -m portend localhost:31923 free
(exits immediately)
python -m portend -t 1 localhost:31923 occupied
(one second passes)
Port 31923 not bound on localhost.
Portend also exposes a ``find_available_local_port`` for identifying
a suitable port for binding locally::
port = portend.find_available_local_port()
print(port, "is available for binding")
Portend additionally exposes the lower-level port checking functionality
in the ``Checker`` class, which currently exposes only one public
method, ``assert_free``::
portend.Checker().assert_free('localhost', 31923)
If assert_free is passed a host/port combination that is occupied by
a bound listener (i.e. a TCP connection is established to that host/port),
assert_free will raise a ``PortNotFree`` exception.
%package -n python3-portend
Summary: TCP port monitoring and discovery
Provides: python-portend
BuildRequires: python3-devel
BuildRequires: python3-flit
BuildRequires: python3-wheel
BuildRequires: python3-pip
%description -n python3-portend
Use portend to monitor TCP ports for bound or unbound states.
For example, to wait for a port to be occupied, timing out after 3 seconds::
portend.occupied('www.google.com', 80, timeout=3)
Or to wait for a port to be free, timing out after 5 seconds::
portend.free('::1', 80, timeout=5)
The portend may also be executed directly. If the function succeeds, it
returns nothing and exits with a status of 0. If it fails, it prints a
message and exits with a status of 1. For example::
python -m portend localhost:31923 free
(exits immediately)
python -m portend -t 1 localhost:31923 occupied
(one second passes)
Port 31923 not bound on localhost.
Portend also exposes a ``find_available_local_port`` for identifying
a suitable port for binding locally::
port = portend.find_available_local_port()
print(port, "is available for binding")
Portend additionally exposes the lower-level port checking functionality
in the ``Checker`` class, which currently exposes only one public
method, ``assert_free``::
portend.Checker().assert_free('localhost', 31923)
If assert_free is passed a host/port combination that is occupied by
a bound listener (i.e. a TCP connection is established to that host/port),
assert_free will raise a ``PortNotFree`` exception.
%package help
Summary: Development documents and examples for portend
Provides: python3-portend-doc
%description help
Use portend to monitor TCP ports for bound or unbound states.
For example, to wait for a port to be occupied, timing out after 3 seconds::
portend.occupied('www.google.com', 80, timeout=3)
Or to wait for a port to be free, timing out after 5 seconds::
portend.free('::1', 80, timeout=5)
The portend may also be executed directly. If the function succeeds, it
returns nothing and exits with a status of 0. If it fails, it prints a
message and exits with a status of 1. For example::
python -m portend localhost:31923 free
(exits immediately)
python -m portend -t 1 localhost:31923 occupied
(one second passes)
Port 31923 not bound on localhost.
Portend also exposes a ``find_available_local_port`` for identifying
a suitable port for binding locally::
port = portend.find_available_local_port()
print(port, "is available for binding")
Portend additionally exposes the lower-level port checking functionality
in the ``Checker`` class, which currently exposes only one public
method, ``assert_free``::
portend.Checker().assert_free('localhost', 31923)
If assert_free is passed a host/port combination that is occupied by
a bound listener (i.e. a TCP connection is established to that host/port),
assert_free will raise a ``PortNotFree`` exception.
%prep
%autosetup -n portend-3.2.0 -p1
%build
%pyproject_build
%install
%pyproject_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
%files -n python3-portend
%{python3_sitelib}/*
%files help
%{_docdir}/*
%changelog
* Tue Jul 11 2023 chenzixuan <chenzixuan@kylinos.cn> - 3.2.0-1
- Upgrade to version 3.2.0
* Wed Jul 06 2022 xu_ping <xuping33@h-partners.com> - 3.1.0-2
- Add version fixes no version in build product
* Tue Jun 21 2022 houyingchao <houyingchao@h-partners.com> - 3.1.0-1
- Upgrade to version 3.1.0
* Mon Nov 16 2020 zhanghua <zhanghua@huawei.com> - 2.6-2
- fix random build failed
* Mon Nov 16 2020 Python_Bot <Python_Bot@openeuler.org> - 2.6-1
- Package init