commit 2c4082d27cc15b4729e33b2e7738bf728178b1f7f04f1da2026eeca555d1fe74 Author: Tomáš Chvátal Date: Fri Mar 22 10:21:34 2019 +0000 Accepting request 687435 from home:jayvdb:coala:test-rig - Remove unnecessary build dependency python-devel - Activate test suite - Add %doc and %license - Remove test module from runtime package - Tidy update-alternatives OBS-URL: https://build.opensuse.org/request/show/687435 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-port-for?expand=0&rev=1 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/port-for-0.4.tar.gz b/port-for-0.4.tar.gz new file mode 100644 index 0000000..ddd1ca6 --- /dev/null +++ b/port-for-0.4.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:47b5cb48f8e036497cd73b96de305cecb4070e9ecbc908724afcbd2224edccde +size 19450 diff --git a/python-port-for.changes b/python-port-for.changes new file mode 100644 index 0000000..443ce29 --- /dev/null +++ b/python-port-for.changes @@ -0,0 +1,13 @@ +------------------------------------------------------------------- +Thu Mar 21 16:59:48 UTC 2019 - John Vandenberg + +- Remove unnecessary build dependency python-devel +- Activate test suite +- Add %doc and %license +- Remove test module from runtime package +- Tidy update-alternatives + +------------------------------------------------------------------- +Wed Jan 23 13:37:38 UTC 2019 - lars@linux-schulserver.de + +- initial version 0.4 diff --git a/python-port-for.spec b/python-port-for.spec new file mode 100644 index 0000000..e2958ef --- /dev/null +++ b/python-port-for.spec @@ -0,0 +1,99 @@ +# +# spec file for package python-port-for +# +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via http://bugs.opensuse.org/ + + +%{?!python_module:%define python_module() python-%{**} python3-%{**}} +Name: python-port-for +Version: 0.4 +Release: 0 +License: MIT +Summary: Utility that helps with local TCP ports managment +Url: https://github.com/kmike/port-for/ +Group: Development/Languages/Python +Source: https://files.pythonhosted.org/packages/source/p/port_for/port-for-%{version}.tar.gz +BuildRequires: python-rpm-macros +BuildRequires: %{python_module mock} +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module setuptools} +BuildRequires: fdupes +Requires(post): update-alternatives +Requires(postun): update-alternatives +BuildArch: noarch + +%python_subpackages + +%description +port-for is a command-line utility and a python library that +helps with local TCP ports management. + +It can find an unused TCP localhost port and remember the association:: + + $ sudo port-for foo + 37987 + +This can be useful when you are installing a stack of software +with multiple parts needing port numbers. + +There are several rules port-for is trying to follow to find and +return a new unused port: + +1) Port must be unused: port-for checks this by trying to connect + to the port and to bind to it. + +2) Port must be IANA unassigned and otherwise not well-known: + this is acheived by maintaining unassigned ports list + (parsed from IANA and Wikipedia). + +3) Port shouldn't be inside ephemeral port range. + This is important because ports from ephemeral port range can + be assigned temporary by OS (e.g. by machine's IP stack) and + this may prevent service restart in some circumstances. + ``port-for`` doesn't return ports from ephemeral port ranges + configured at the current machine. + +4) Other heuristics are also applied: ``port-for`` tries to return + a port from larger port ranges; it also doesn't return ports that are + too close to well-known ports. + +%prep +%setup -q -n port-for-%{version} + +%build +%python_build + +%install +%python_install +%python_expand rm -f %{buildroot}%{$python_sitelib}/port_for/tests.py* %{buildroot}%{$python_sitelib}/port_for/__pycache__/tests.* +%python_clone -a %{buildroot}%{_bindir}/port-for +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +%python_exec -m pytest --doctest-modules port_for/utils.py port_for/tests.py + +%post +%python_install_alternative port-for + +%postun +%python_uninstall_alternative port-for + +%files %{python_files} +%license LICENSE.txt +%doc README.rst +%{python_sitelib}/* +%python_alternative %{_bindir}/port-for + + +%changelog