Compare commits

...

No commits in common. "c8" and "c9s" have entirely different histories.
c8 ... c9s

11 changed files with 271 additions and 87 deletions

15
.gitignore vendored
View File

@ -1 +1,14 @@
SOURCES/netaddr-0.7.19.tar.gz netaddr-0.7.4.tar.gz
/netaddr-0.7.5.tar.gz
/netaddr-0.7.11.tar.gz
/netaddr-0.7.12.tar.gz
/netaddr-0.7.14.tar.gz
/netaddr-0.7.15.tar.gz
/netaddr-0.7.15-tests.tar.gz
/netaddr-0.7.17.tar.gz
/netaddr-0.7.18.tar.gz
/netaddr-0.7.19.tar.gz
/netaddr-0.7.20.tar.gz
/netaddr-0.8.0.tar.gz
/netaddr-0.10.1.tar.gz
/THANKS

View File

@ -1 +0,0 @@
00e0ce7d7ebc1d6e7943e884aa51ccb7becdc9ea SOURCES/netaddr-0.7.19.tar.gz

View File

@ -0,0 +1,65 @@
From 80071f4450261b70b70f537bc2b54d2c97d9f562 Mon Sep 17 00:00:00 2001
From: "David P. D. Moss" <drkjam@gmail.com>
Date: Thu, 25 Nov 2010 08:53:49 +0000
Subject: [PATCH] Fixed github Issue no. 2. Thanks keesbos.
---
netaddr/ip/__init__.py | 2 ++
netaddr/tests/2.x/ip/constructor.txt | 11 +++++++++++
netaddr/tests/3.x/ip/constructor.txt | 11 +++++++++++
3 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/netaddr/ip/__init__.py b/netaddr/ip/__init__.py
index 0179c38..e4a6b7b 100644
--- a/netaddr/ip/__init__.py
+++ b/netaddr/ip/__init__.py
@@ -779,6 +779,8 @@ def parse_ip_network(module, addr, implicit_prefix=False, flags=0):
# Try a partial IPv4 network address...
expanded_addr = _ipv4.expand_partial_address(val1)
ip = IPAddress(expanded_addr, module.version, flags=INET_PTON)
+ else:
+ raise AddrFormatError('invalid IPNetwork address %s!' % addr)
value = ip._value
try:
diff --git a/netaddr/tests/2.x/ip/constructor.txt b/netaddr/tests/2.x/ip/constructor.txt
index f67f5e4..5a9e978 100644
--- a/netaddr/tests/2.x/ip/constructor.txt
+++ b/netaddr/tests/2.x/ip/constructor.txt
@@ -209,3 +209,14 @@ IPNetwork('172.24.0.0/16')
}}}
+
+Negative testing
+
+{{{
+
+>>> IPNetwork('foo')
+Traceback (most recent call last):
+...
+AddrFormatError: invalid IPNetwork foo
+
+}}}
diff --git a/netaddr/tests/3.x/ip/constructor.txt b/netaddr/tests/3.x/ip/constructor.txt
index 2ec47c0..35a5cd6 100644
--- a/netaddr/tests/3.x/ip/constructor.txt
+++ b/netaddr/tests/3.x/ip/constructor.txt
@@ -209,3 +209,14 @@ IPNetwork('172.24.0.0/16')
}}}
+
+Negative testing
+
+{{{
+
+>>> IPNetwork('foo')
+Traceback (most recent call last):
+...
+netaddr.core.AddrFormatError: invalid IPNetwork foo
+
+}}}
--
1.7.5.2

View File

@ -0,0 +1,26 @@
From 2599f0e57c0a20bd3f8870dbc2c5479cad502597 Mon Sep 17 00:00:00 2001
From: Sergey Kozlov <sergey.kozlov@intel.com>
Date: Mon, 11 Dec 2017 17:04:20 +0100
Subject: [PATCH] PEP 479: 'return' instead of 'raise StopIteration'.
Fro details please visit https://www.python.org/dev/peps/pep-0479/
---
netaddr/ip/__init__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/netaddr/ip/__init__.py b/netaddr/ip/__init__.py
index 489badf..ecf72d0 100644
--- a/netaddr/ip/__init__.py
+++ b/netaddr/ip/__init__.py
@@ -1258,7 +1258,7 @@ class IPNetwork(BaseIP, IPListMixin):
if not self.prefixlen <= prefixlen:
# Don't return anything.
- raise StopIteration
+ return
# Calculate number of subnets to be returned.
width = self._module.width
--
2.17.1

7
gating.yaml Normal file
View File

@ -0,0 +1,7 @@
# recipients: abokovoy, frenaud, kaleem, ftrivino, fcami
--- !Policy
product_versions:
- rhel-9
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

View File

@ -0,0 +1,35 @@
From 4b1f09a7e122f6b7af699242b58b5284c5eeab00 Mon Sep 17 00:00:00 2001
From: John Eckersberg <jeckersb@redhat.com>
Date: Tue, 30 Jun 2015 11:03:57 -0400
Subject: [PATCH] Fix bad pop() assumption in test
Do not assume that IPSet.pop will always return the same item. The
pop method is implemented via the popitem method on the underlying
_cidrs object, which is a dict.
dict.popitem is documented as:
Remove and return an arbitrary (key, value) pair from the dictionary.
So one cannot assert that the value popped from an IPSet will be a
specific item in the set.
Instead, assert that the item popped out of the set is present in the
other set.
---
test/ip/test_ip_sets.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/ip/test_ip_sets.py b/test/ip/test_ip_sets.py
index 3732a11..32589e1 100644
--- a/test/ip/test_ip_sets.py
+++ b/test/ip/test_ip_sets.py
@@ -34,7 +34,7 @@ def test_ipset_basic_api():
])
assert set1 == set2
- assert set2.pop() == IPNetwork('192.0.2.4/30')
+ assert set2.pop() in set1
assert set1 != set2

View File

@ -1,26 +1,21 @@
%if 0%{?fedora} || 0%{?rhel} > 7 %bcond docs %{undefined rhel}
%global with_python3 1
%endif
%if 0%{?rhel} > 7
%bcond_with python2
%else
%bcond_without python2
%endif
Name: python-netaddr Name: python-netaddr
Version: 0.7.19 Version: 0.10.1
Release: 8%{?dist} Release: 3%{?dist}
Summary: A pure Python network address representation and manipulation library Summary: A pure Python network address representation and manipulation library
License: BSD License: BSD
URL: http://github.com/drkjam/netaddr URL: http://github.com/drkjam/netaddr
Source0: https://pypi.python.org/packages/source/n/netaddr/netaddr-%{version}.tar.gz Source0: https://pypi.python.org/packages/source/n/netaddr/netaddr-%{version}.tar.gz
# Remove once https://github.com/netaddr/netaddr/pull/345
Source1: THANKS
BuildArch: noarch BuildArch: noarch
%if %{with docs}
Patch0: 0001-fixed-broken-tests-in-issue-149-python-3-regression-.patch BuildRequires: python3-sphinx
Patch1: 0001-Do-not-override-executable-path.patch BuildRequires: python3-furo
%endif
%global desc A network address manipulation library for Python\ %global desc A network address manipulation library for Python\
\ \
@ -31,7 +26,8 @@ Layer 3 addresses\
* IPv4 and IPv6 addresses, subnets, masks, prefixes\ * IPv4 and IPv6 addresses, subnets, masks, prefixes\
* iterating, slicing, sorting, summarizing and classifying IP networks\ * iterating, slicing, sorting, summarizing and classifying IP networks\
* dealing with various ranges formats (CIDR, arbitrary ranges and globs, nmap)\ * dealing with various ranges formats (CIDR, arbitrary ranges and globs, nmap)\
* set based operations (unions, intersections etc) over IP addresses and subnets\ * set based operations (unions, intersections etc) over IP addresses and\
subnets\
* parsing a large variety of different formats and notations\ * parsing a large variety of different formats and notations\
* looking up IANA IP block information\ * looking up IANA IP block information\
* generating DNS reverse lookups\ * generating DNS reverse lookups\
@ -49,113 +45,136 @@ Layer 2 addresses\
%description %_description %description %_description
%if %{with python2}
%package -n python2-netaddr
Summary: %summary
%{?python_provide:%python_provide python2-netaddr}
BuildRequires: python2-devel
BuildRequires: python2-setuptools
BuildRequires: python2-sphinx
BuildRequires: python2-pytest
%description -n python2-netaddr %_description
%endif #{with python2}
%if 0%{?with_python3}
%package -n python3-netaddr %package -n python3-netaddr
Summary: A pure Python network address representation and manipulation library Summary: A pure Python network address representation and manipulation library
BuildRequires: python3-devel BuildRequires: python3-devel
BuildRequires: python3-setuptools BuildRequires: python3-setuptools
BuildRequires: python3-sphinx
BuildRequires: python3-pytest BuildRequires: python3-pytest
%description -n python3-netaddr %description -n python3-netaddr
%{desc} %{desc}
%endif
%prep %prep
%setup -q -n netaddr-%{version} %autosetup -n netaddr-%{version} -p1
%patch0 -p1
%patch1 -p1
# Make rpmlint happy, get rid of DOS line endings
sed -i 's/\r//' netaddr/*.py netaddr/ip/*.py netaddr/eui/*.idx
# Make rpmlint happy, rip out python shebang lines from most python # Make rpmlint happy, rip out python shebang lines from most python
# modules # modules
find netaddr -name "*.py" | \ find netaddr -name "*.py" | \
xargs sed -i -e '1 {/^#!\//d}' xargs sed -i -e '1 {/^#!\//d}'
# Fix python executable
%if %{with python2}
sed -i -e '1s,/usr/bin/env python,%{__python2} %{?py_shbang_opts},' netaddr/tools/netaddr
%else
sed -i -e '1s,/usr/bin/env python,%{__python3} %{?py_shbang_opts},' netaddr/tools/netaddr
%endif #{with python2}
# Make rpmlint happy, fix permissions on documentation files # Make rpmlint happy, fix permissions on documentation files
chmod 0644 README.md AUTHORS CHANGELOG COPYRIGHT LICENSE PKG-INFO chmod 0644 README.rst AUTHORS CHANGELOG COPYRIGHT LICENSE PKG-INFO
%build %build
%if %{with python2}
%py2_build
%endif #{with python2}
%if 0%{?with_python3}
%py3_build %py3_build
%endif
#docs #docs
%if %{with docs}
pushd docs pushd docs
%if %{with python2} PYTHONPATH='../' sphinx-build-%{python3_version} -b html -d build/doctrees source html
PYTHONPATH='../' sphinx-build -b html -d build/doctrees source html rm -f python3/html/.buildinfo
%endif #{with python2}
%if 0%{?with_python3}
PYTHONPATH='../' sphinx-build-%{python3_version} -b html -d build/doctrees source python3/html
%endif
popd popd
%endif
%install %install
%if 0%{?with_python3}
%py3_install %py3_install
mv %{buildroot}%{_bindir}/netaddr %{buildroot}%{_bindir}/netaddr3
%endif
%if %{with python2}
%py2_install
%endif #{with python2}
%check %check
%if %{with python2} py.test-%{python3_version}
py.test-%{python2_version}
%endif #{with python2}
%if 0%{?with_python3}
LANG=en_US.UTF-8 py.test-%{python3_version}
%endif
%if %{with python2}
%files -n python2-netaddr
%license COPYRIGHT LICENSE
%doc AUTHORS CHANGELOG
%doc README.md docs/html
%{python2_sitelib}/*
%{_bindir}/netaddr
%endif #{with python2}
%if 0%{?with_python3}
%files -n python3-netaddr %files -n python3-netaddr
%license COPYRIGHT %license COPYRIGHT
%doc AUTHORS CHANGELOG %doc AUTHORS CHANGELOG README.rst
%doc README.md docs/python3/html %if %{with docs}
%{python3_sitelib}/* %doc docs/python3/html
%{_bindir}/netaddr3
%endif %endif
%{python3_sitelib}/*
%{_bindir}/netaddr
%changelog %changelog
* Mon Jul 09 2018 Petr Viktorin <pviktori@redhat.com> - 0.7.19-8 * Wed Nov 13 2024 Rafael Jeffman <rjeffman@redhat.com> - 0.10.1-3
- Don't build python2 subpackage on rhel>7 - Bump version to rebuild due to brew issues
https://bugzilla.redhat.com/show_bug.cgi?id=1567153 Resolves: RHEL-25506
* Tue Nov 12 2024 Rafael Jeffman <rjeffman@redhat.com> - 0.10.1-2
- Remove subpackage python3-netaddr-shell
Resolves: RHEL-25506
* Mon Nov 11 2024 Rafael Jeffman <rjeffman@redhat.com> - 0.10.1-1
- Rebase to version 0.10.1
Resolves: RHEL-25506
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 0.8.0-5
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 0.8.0-4
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.8.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.8.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Fri Jul 3 2020 John Eckersberg <jeckersb@redhat.com> - 0.8.0-1
- New upstream release 0.8.0 (rhbz#1853684)
* Fri Jun 19 2020 John Eckersberg <jeckersb@redhat.com> - 0.7.20-1
- New upstream release 0.7.20 (rhbz#1848782)
- Minor spec and rpmlint cleanups
* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 0.7.19-22
- Rebuilt for Python 3.9
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.19-21
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Thu Nov 7 2019 John Eckersberg <eck@redhat.com> - 0.7.19-20
- Remove python2 subpackage from Fedora 32+ (rhbz#1769871)
* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 0.7.19-19
- Rebuilt for Python 3.8.0rc1 (#1748018)
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 0.7.19-18
- Rebuilt for Python 3.8
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.19-17
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Mon Jul 22 2019 John Eckersberg <eck@redhat.com> - 0.7.19-16
- Move /usr/bin/netaddr to python3 and remove python2 version
See https://fedoraproject.org/wiki/Changes/Python_means_Python3
* Mon Mar 11 2019 John Eckersberg <eck@redhat.com> - 0.7.19-15
- Remove BuildRequires on python2-sphinx
See https://fedoraproject.org/wiki/Changes/Sphinx2
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.19-14
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Wed Nov 28 2018 John Eckersberg <eck@redhat.com> - 0.7.19-13
- Add python_provide for python3 subpackage per packaging guidelines (RHBZ#1654198)
* Sun Nov 18 2018 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 0.7.19-12
- Drop explicit locale setting
See https://fedoraproject.org/wiki/Changes/Remove_glibc-langpacks-all_from_buildroot
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.19-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 0.7.19-10
- Rebuilt for Python 3.7
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 0.7.19-9
- Rebuilt for Python 3.7
* Thu Feb 22 2018 Iryna Shcherbina <ishcherb@redhat.com> - 0.7.19-8
- Update Python 2 dependency declarations to new packaging standards
(See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
* Mon Feb 19 2018 John Eckersberg <eck@redhat.com> - 0.7.19-7 * Mon Feb 19 2018 John Eckersberg <eck@redhat.com> - 0.7.19-7
- Fix shebang mangling for python3 (RHBZ#1546800) - Fix shebang mangling for python3 (RHBZ#1546800)

2
sources Normal file
View File

@ -0,0 +1,2 @@
SHA512 (netaddr-0.10.1.tar.gz) = ca04171d5cbfd569d4f262f4870610edfd98be35899cb70983dbff5f37add963e05987ddbe1ab22d9b615580ac1abe96a8c2903681b18af8c9f2f96899b618ff
SHA512 (THANKS) = 056e48f59f855125c636c5e94a775a6c76d8d7318a71d4c4ac502f9e2c7ac503bc65816b9c62674aa67dda7ce3fa240ac67818ac0b76d00ae21f2db35c76e1c2

18
tests/tests.yml Normal file
View File

@ -0,0 +1,18 @@
---
- hosts: localhost
tags:
- classic
roles:
- role: standard-test-source
- role: standard-test-basic
required_packages:
- python3-netaddr
- python3-pytest
tests:
- clean:
dir: source
run: find -name '*.py' -and -not -path '*/tests/*' -delete
- unittests:
dir: source
run: pytest-3 netaddr/tests/