2020-12-14 17:18:36 +08:00
|
|
|
%global _empty_manifest_terminate_build 0
|
2020-12-24 17:01:06 +08:00
|
|
|
Name: python-portend
|
|
|
|
|
Version: 2.6
|
|
|
|
|
Release: 2
|
|
|
|
|
Summary: TCP port monitoring and discovery
|
|
|
|
|
License: MIT
|
|
|
|
|
URL: https://pypi.org/project/portend
|
|
|
|
|
Source0: https://files.pythonhosted.org/packages/04/98/997f8668b11292f13d3e69fc626232c497228306c764523c5a3a3b59c775/portend-2.6.tar.gz
|
|
|
|
|
BuildArch: noarch
|
2020-12-14 17:18:36 +08:00
|
|
|
Recommends: %{name}-help = %{version}-%{release}
|
|
|
|
|
|
2020-12-24 17:01:06 +08:00
|
|
|
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
|
2020-12-14 17:18:36 +08:00
|
|
|
|
|
|
|
|
%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
|
2020-12-24 17:01:06 +08:00
|
|
|
Summary: TCP port monitoring and discovery
|
|
|
|
|
Provides: python-portend
|
|
|
|
|
BuildRequires: python3-devel
|
|
|
|
|
BuildRequires: python3-setuptools
|
|
|
|
|
BuildRequires: python3-setuptools_scm
|
2020-12-14 17:18:36 +08:00
|
|
|
%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
|
2020-12-24 17:01:06 +08:00
|
|
|
Summary: Development documents and examples for portend
|
|
|
|
|
Provides: python3-portend-doc
|
2020-12-14 17:18:36 +08:00
|
|
|
%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-2.6
|
|
|
|
|
|
|
|
|
|
%build
|
|
|
|
|
%py3_build
|
|
|
|
|
|
|
|
|
|
%install
|
|
|
|
|
%py3_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
|
|
|
|
|
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
|
|
|
|
|
pushd %{buildroot}
|
|
|
|
|
if [ -d usr/lib ]; then
|
|
|
|
|
find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
|
|
|
|
|
fi
|
|
|
|
|
if [ -d usr/lib64 ]; then
|
|
|
|
|
find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
|
|
|
|
|
fi
|
|
|
|
|
if [ -d usr/bin ]; then
|
|
|
|
|
find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
|
|
|
|
|
fi
|
|
|
|
|
if [ -d usr/sbin ]; then
|
|
|
|
|
find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
|
|
|
|
|
fi
|
|
|
|
|
touch doclist.lst
|
|
|
|
|
if [ -d usr/share/man ]; then
|
|
|
|
|
find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
|
|
|
|
|
fi
|
|
|
|
|
popd
|
|
|
|
|
mv %{buildroot}/filelist.lst .
|
|
|
|
|
mv %{buildroot}/doclist.lst .
|
|
|
|
|
|
|
|
|
|
%files -n python3-portend -f filelist.lst
|
|
|
|
|
%dir %{python3_sitelib}/*
|
|
|
|
|
|
|
|
|
|
%files help -f doclist.lst
|
|
|
|
|
%{_docdir}/*
|
|
|
|
|
|
|
|
|
|
%changelog
|
2020-12-24 17:01:06 +08:00
|
|
|
* 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
|
2020-12-14 17:18:36 +08:00
|
|
|
- Package init
|