!1 package init

From: @caodongxia
Reviewed-by: @jeff200902,@shinwell_hu,@myeuler
Signed-off-by: @shinwell_hu,@myeuler
This commit is contained in:
openeuler-ci-bot 2020-12-17 00:19:21 +08:00 committed by Gitee
commit 1311254364
3 changed files with 152 additions and 0 deletions

BIN
portend-2.6.tar.gz Normal file

Binary file not shown.

148
python-portend.spec Normal file
View File

@ -0,0 +1,148 @@
%global _empty_manifest_terminate_build 0
Name: python-portend
Version: 2.6
Release: 1
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
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-setuptools
%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-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
* Mon Nov 16 2020 Python_Bot <Python_Bot@openeuler.org>
- Package init

4
python-portend.yaml Normal file
View File

@ -0,0 +1,4 @@
version_control: pypi
src_repo: portend
tag_prefix: "^"
separator: "."