From ebb0d39922cf0224aa02785a8ae1aa4d74abc1c7 Mon Sep 17 00:00:00 2001 From: John Eckersberg Date: Wed, 3 Jan 2024 14:23:31 -0500 Subject: [PATCH] New upstream release 0.10.1 (rhbz#2256342) --- .gitignore | 2 + ...mprove-Python-3.13-compatibility-272.patch | 181 ------------------ python-netaddr.spec | 25 ++- sources | 3 +- 4 files changed, 20 insertions(+), 191 deletions(-) delete mode 100644 0001-Improve-Python-3.13-compatibility-272.patch diff --git a/.gitignore b/.gitignore index 9d08004..9d1b769 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,5 @@ netaddr-0.7.4.tar.gz /netaddr-0.7.20.tar.gz /netaddr-0.8.0.tar.gz /netaddr-0.9.0.tar.gz +/netaddr-0.10.1.tar.gz +/THANKS diff --git a/0001-Improve-Python-3.13-compatibility-272.patch b/0001-Improve-Python-3.13-compatibility-272.patch deleted file mode 100644 index 579a17b..0000000 --- a/0001-Improve-Python-3.13-compatibility-272.patch +++ /dev/null @@ -1,181 +0,0 @@ -From e84f04c0bbf2b9ad47005214af70aebbb92ba586 Mon Sep 17 00:00:00 2001 -From: John Eckersberg -Date: Wed, 13 Dec 2023 13:49:55 -0500 -Subject: [PATCH] Improve Python 3.13 compatibility (#272) - -importlib.resources.open_binary() has been deprecated - -See: -https://docs.python.org/3.13/whatsnew/3.13.html -https://docs.python.org/3/library/importlib.resources.html#importlib.resources.open_binary - -Originally reported via: -https://bugzilla.redhat.com/show_bug.cgi?id=2246093 ---- - netaddr/compat.py | 6 ++++++ - netaddr/eui/__init__.py | 6 +++--- - netaddr/eui/ieee.py | 6 +++--- - netaddr/ip/iana.py | 10 +++++----- - netaddr/tests/eui/test_ieee_parsers.py | 10 +++++----- - 5 files changed, 22 insertions(+), 16 deletions(-) - -diff --git a/netaddr/compat.py b/netaddr/compat.py -index 201dca6..1ad0efd 100644 ---- a/netaddr/compat.py -+++ b/netaddr/compat.py -@@ -91,3 +91,9 @@ try: - from importlib import resources as _importlib_resources - except ImportError: - import importlib_resources as _importlib_resources -+ -+try: -+ _open_binary = _importlib_resources.open_binary -+except AttributeError: -+ def _open_binary(pkg, res): -+ return _importlib_resources.files(pkg).joinpath(res).open('rb') -diff --git a/netaddr/eui/__init__.py b/netaddr/eui/__init__.py -index 07bbdc3..840b01f 100644 ---- a/netaddr/eui/__init__.py -+++ b/netaddr/eui/__init__.py -@@ -13,7 +13,7 @@ from netaddr.strategy import eui48 as _eui48, eui64 as _eui64 - from netaddr.strategy.eui48 import mac_eui48 - from netaddr.strategy.eui64 import eui64_base - from netaddr.ip import IPAddress --from netaddr.compat import _importlib_resources, _is_int, _is_str -+from netaddr.compat import _open_binary, _is_int, _is_str - - - class BaseIdentifier(object): -@@ -91,7 +91,7 @@ class OUI(BaseIdentifier): - - # Discover offsets. - if self._value in ieee.OUI_INDEX: -- fh = _importlib_resources.open_binary(__package__, 'oui.txt') -+ fh = _open_binary(__package__, 'oui.txt') - for (offset, size) in ieee.OUI_INDEX[self._value]: - fh.seek(offset) - data = fh.read(size).decode('UTF-8') -@@ -261,7 +261,7 @@ class IAB(BaseIdentifier): - - # Discover offsets. - if self._value in ieee.IAB_INDEX: -- fh = _importlib_resources.open_binary(__package__, 'iab.txt') -+ fh = _open_binary(__package__, 'iab.txt') - (offset, size) = ieee.IAB_INDEX[self._value][0] - self.record['offset'] = offset - self.record['size'] = size -diff --git a/netaddr/eui/ieee.py b/netaddr/eui/ieee.py -index 3e66d55..d7d177f 100755 ---- a/netaddr/eui/ieee.py -+++ b/netaddr/eui/ieee.py -@@ -35,7 +35,7 @@ More details can be found at the following URLs :- - import os.path as _path - import csv as _csv - --from netaddr.compat import _bytes_type, _importlib_resources -+from netaddr.compat import _bytes_type, _open_binary - from netaddr.core import Subscriber, Publisher - - -@@ -281,8 +281,8 @@ def load_index(index, fp): - - def load_indices(): - """Load OUI and IAB lookup indices into memory""" -- load_index(OUI_INDEX, _importlib_resources.open_binary(__package__, 'oui.idx')) -- load_index(IAB_INDEX, _importlib_resources.open_binary(__package__, 'iab.idx')) -+ load_index(OUI_INDEX, _open_binary(__package__, 'oui.idx')) -+ load_index(IAB_INDEX, _open_binary(__package__, 'iab.idx')) - - - if __name__ == '__main__': -diff --git a/netaddr/ip/iana.py b/netaddr/ip/iana.py -index 49da06e..c2c0185 100755 ---- a/netaddr/ip/iana.py -+++ b/netaddr/ip/iana.py -@@ -34,7 +34,7 @@ from xml.sax import make_parser, handler - - from netaddr.core import Publisher, Subscriber - from netaddr.ip import IPAddress, IPNetwork, IPRange, cidr_abbrev_to_verbose --from netaddr.compat import _dict_items, _callable, _importlib_resources -+from netaddr.compat import _dict_items, _callable, _open_binary - - - -@@ -367,21 +367,21 @@ def load_info(): - Parse and load internal IANA data lookups with the latest information from - data files. - """ -- ipv4 = IPv4Parser(_importlib_resources.open_binary(__package__, 'ipv4-address-space.xml')) -+ ipv4 = IPv4Parser(_open_binary(__package__, 'ipv4-address-space.xml')) - ipv4.attach(DictUpdater(IANA_INFO['IPv4'], 'IPv4', 'prefix')) - ipv4.parse() - -- ipv6 = IPv6Parser(_importlib_resources.open_binary(__package__, 'ipv6-address-space.xml')) -+ ipv6 = IPv6Parser(_open_binary(__package__, 'ipv6-address-space.xml')) - ipv6.attach(DictUpdater(IANA_INFO['IPv6'], 'IPv6', 'prefix')) - ipv6.parse() - - ipv6ua = IPv6UnicastParser( -- _importlib_resources.open_binary(__package__, 'ipv6-unicast-address-assignments.xml'), -+ _open_binary(__package__, 'ipv6-unicast-address-assignments.xml'), - ) - ipv6ua.attach(DictUpdater(IANA_INFO['IPv6_unicast'], 'IPv6_unicast', 'prefix')) - ipv6ua.parse() - -- mcast = MulticastParser(_importlib_resources.open_binary(__package__, 'multicast-addresses.xml')) -+ mcast = MulticastParser(_open_binary(__package__, 'multicast-addresses.xml')) - mcast.attach(DictUpdater(IANA_INFO['multicast'], 'multicast', 'address')) - mcast.parse() - -diff --git a/netaddr/tests/eui/test_ieee_parsers.py b/netaddr/tests/eui/test_ieee_parsers.py -index f14edf4..69dc014 100644 ---- a/netaddr/tests/eui/test_ieee_parsers.py -+++ b/netaddr/tests/eui/test_ieee_parsers.py -@@ -3,7 +3,7 @@ import sys - - import pytest - --from netaddr.compat import _importlib_resources -+from netaddr.compat import _open_binary - from netaddr.eui.ieee import OUIIndexParser, IABIndexParser, FileIndexer - - -@@ -11,7 +11,7 @@ from netaddr.eui.ieee import OUIIndexParser, IABIndexParser, FileIndexer - def test_oui_parser_py2(): - from cStringIO import StringIO - outfile = StringIO() -- with contextlib.closing(_importlib_resources.open_binary(__package__, 'sample_oui.txt')) as infile: -+ with contextlib.closing(_open_binary(__package__, 'sample_oui.txt')) as infile: - iab_parser = OUIIndexParser(infile) - iab_parser.attach(FileIndexer(outfile)) - iab_parser.parse() -@@ -22,7 +22,7 @@ def test_oui_parser_py2(): - def test_iab_parser_py2(): - from cStringIO import StringIO - outfile = StringIO() -- with contextlib.closing(_importlib_resources.open_binary(__package__, 'sample_iab.txt')) as infile: -+ with contextlib.closing(_open_binary(__package__, 'sample_iab.txt')) as infile: - iab_parser = IABIndexParser(infile) - iab_parser.attach(FileIndexer(outfile)) - iab_parser.parse() -@@ -33,7 +33,7 @@ def test_iab_parser_py2(): - def test_oui_parser_py3(): - from io import StringIO - outfile = StringIO() -- with contextlib.closing(_importlib_resources.open_binary(__package__, 'sample_oui.txt')) as infile: -+ with contextlib.closing(_open_binary(__package__, 'sample_oui.txt')) as infile: - iab_parser = OUIIndexParser(infile) - iab_parser.attach(FileIndexer(outfile)) - iab_parser.parse() -@@ -44,7 +44,7 @@ def test_oui_parser_py3(): - def test_iab_parser_py3(): - from io import StringIO - outfile = StringIO() -- with contextlib.closing(_importlib_resources.open_binary(__package__, 'sample_iab.txt')) as infile: -+ with contextlib.closing(_open_binary(__package__, 'sample_iab.txt')) as infile: - iab_parser = IABIndexParser(infile) - iab_parser.attach(FileIndexer(outfile)) - iab_parser.parse() --- -2.43.0 - diff --git a/python-netaddr.spec b/python-netaddr.spec index fe953aa..d1ea0c1 100644 --- a/python-netaddr.spec +++ b/python-netaddr.spec @@ -1,14 +1,17 @@ Name: python-netaddr -Version: 0.9.0 -Release: 2%{?dist} +Version: 0.10.1 +Release: 1%{?dist} Summary: A pure Python network address representation and manipulation library License: BSD-3-Clause URL: https://github.com/drkjam/netaddr 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 BuildRequires: python3-sphinx +BuildRequires: python3-furo %global desc A network address manipulation library for Python\ \ @@ -32,11 +35,6 @@ Layer 2 addresses\ * looking up IEEE organisational information (OUI, IAB)\ * generating derived IPv6 addresses -# https://bugzilla.redhat.com/show_bug.cgi?id=2246093 -# Merged upstream via https://github.com/netaddr/netaddr/pull/272 -# To be removed when version > 0.9.0 released -Patch0: 0001-Improve-Python-3.13-compatibility-272.patch - %global _description\ %{desc} @@ -45,6 +43,7 @@ Patch0: 0001-Improve-Python-3.13-compatibility-272.patch %package -n python3-netaddr Summary: A pure Python network address representation and manipulation library BuildRequires: python3-devel + BuildRequires: python3-setuptools BuildRequires: python3-sphinx BuildRequires: python3-pytest @@ -71,13 +70,15 @@ find netaddr -name "*.py" | \ # Make rpmlint happy, fix permissions on documentation files chmod 0644 README.rst AUTHORS CHANGELOG COPYRIGHT LICENSE PKG-INFO +# Include missing THANKS file +# Remove once https://github.com/netaddr/netaddr/pull/345 +mv %{SOURCE1} . + %build %py3_build #docs pushd docs -PYTHONPATH='../' sphinx-build-%{python3_version} -b html -d build/doctrees source html -rm -f html/.buildinfo PYTHONPATH='../' sphinx-build-%{python3_version} -b html -d build/doctrees source python3/html rm -f python3/html/.buildinfo popd @@ -100,6 +101,12 @@ py.test-%{python3_version} %{_bindir}/netaddr %changelog +* Wed Jan 3 2024 John Eckersberg - 0.10.1-1 +- New upstream release 0.10.1 (rhbz#2256342) +- Remove patch for Python 3.13 compatibility (merged upstream in 0.10.0) +- Add new depencency on furo +- Include missing THANKS file (https://github.com/netaddr/netaddr/pull/345) + * Thu Dec 14 2023 John Eckersberg - 0.9.0-2 - Add patch for Python 3.13 compatibility (rhbz#2246093) diff --git a/sources b/sources index a58d299..71ddde6 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ -SHA512 (netaddr-0.9.0.tar.gz) = 250b00a930f7180e1b4e18cb90de579733ffea9cd4ac93a3b7d2f7796b30c6b49d70da4b05ed522ebc9389600f4db8ecaed9345f7d0076632d0beae41e11c3ae +SHA512 (netaddr-0.10.1.tar.gz) = ca04171d5cbfd569d4f262f4870610edfd98be35899cb70983dbff5f37add963e05987ddbe1ab22d9b615580ac1abe96a8c2903681b18af8c9f2f96899b618ff +SHA512 (THANKS) = 056e48f59f855125c636c5e94a775a6c76d8d7318a71d4c4ac502f9e2c7ac503bc65816b9c62674aa67dda7ce3fa240ac67818ac0b76d00ae21f2db35c76e1c2