Update to 0.10.1

This commit is contained in:
wk333 2024-02-02 16:47:12 +08:00
parent 3d48136839
commit 9174463919
6 changed files with 13 additions and 1518 deletions

View File

@ -1,68 +0,0 @@
From 606a44b62ea7032f63e359aaaaabc0057e168890 Mon Sep 17 00:00:00 2001
From: niels <nkeulen@gmail.com>
Date: Wed, 27 Jan 2021 20:44:12 +0100
Subject: [PATCH] Fix for is_loopback behaviour (issue: #222) (#223)
---
netaddr/ip/__init__.py | 4 +--
.../tests/ip/test_ip_network_categories.py | 26 +++++++++++++++++++
2 files changed, 28 insertions(+), 2 deletions(-)
create mode 100644 netaddr/tests/ip/test_ip_network_categories.py
diff --git a/netaddr/ip/__init__.py b/netaddr/ip/__init__.py
index d1232eb..9e13b29 100644
--- a/netaddr/ip/__init__.py
+++ b/netaddr/ip/__init__.py
@@ -151,7 +151,7 @@ class BaseIP(object):
if self._module.version == 4:
return self in IPV4_LOOPBACK
elif self._module.version == 6:
- return self == IPV6_LOOPBACK
+ return self in IPV6_LOOPBACK
def is_private(self):
"""
@@ -1949,7 +1949,7 @@ IPV4_RESERVED = (
#-----------------------------------------------------------------------------
# Cached IPv6 address range lookups.
#-----------------------------------------------------------------------------
-IPV6_LOOPBACK = IPAddress('::1')
+IPV6_LOOPBACK = IPNetwork('::1/128')
IPV6_PRIVATE = (
IPNetwork('fc00::/7'), # Unique Local Addresses (ULA)
diff --git a/netaddr/tests/ip/test_ip_network_categories.py b/netaddr/tests/ip/test_ip_network_categories.py
new file mode 100644
index 0000000..9f9961e
--- /dev/null
+++ b/netaddr/tests/ip/test_ip_network_categories.py
@@ -0,0 +1,26 @@
+from netaddr import IPNetwork
+
+
+def test_is_unicast():
+ assert IPNetwork('192.0.2.0/24').is_unicast()
+ assert IPNetwork('fe80::1/48').is_unicast()
+
+
+def test_is_multicast():
+ assert IPNetwork('239.192.0.1/24').is_multicast()
+ assert IPNetwork('ff00::/8').is_multicast()
+
+
+def test_is_private():
+ assert IPNetwork('10.0.0.0/24').is_private()
+ assert IPNetwork('fc00::/7').is_private()
+
+
+def test_is_reserved():
+ assert IPNetwork('240.0.0.0/24').is_reserved()
+ assert IPNetwork('0::/48').is_reserved()
+
+
+def test_is_loopback():
+ assert IPNetwork('127.0.0.0/8').is_loopback()
+ assert IPNetwork('::1/128').is_loopback()
--
2.33.0

View File

@ -16,7 +16,7 @@ diff --git a/netaddr/tests/eui/test_eui.py b/netaddr/tests/eui/test_eui.py
index 645a518..b8dcedd 100644
--- a/netaddr/tests/eui/test_eui.py
+++ b/netaddr/tests/eui/test_eui.py
@@ -146,42 +146,15 @@ def test_eui_oui_information():
@@ -146,42 +146,14 @@ def test_eui_oui_information():
oui = mac.oui
assert str(oui) == '00-1B-77'
@ -48,7 +48,7 @@ index 645a518..b8dcedd 100644
- 'AU',
- ]
- assert oui.registration(1).org == 'ROYAL MELBOURNE INST OF TECH'
assert oui.registration(1).oui == '08-00-30'
- assert oui.registration(1).oui == '08-00-30'
- assert oui.registration(2).address == [
- 'CH-1211',

File diff suppressed because it is too large Load Diff

BIN
netaddr-0.10.1.tar.gz Normal file

Binary file not shown.

Binary file not shown.

View File

@ -1,18 +1,16 @@
Name: python-netaddr
Version: 0.8.0
Release: 6
Version: 0.10.1
Release: 1
Summary: A pure Python network address representation and manipulation library
License: BSD-3-Clause
URL: http://github.com/drkjam/netaddr
Source0: https://pypi.python.org/packages/source/n/netaddr/netaddr-%{version}.tar.gz
Patch9000: elimate-ROC-in-python-netaddr.patch
Patch9001: disable-test-oui-information.patch
Patch9002: 0001-Fix-for-is_loopback-behaviour-issue-222-223.patch
Patch9000: disable-test-oui-information.patch
BuildArch: noarch
BuildRequires: python3-devel python3-setuptools python3-sphinx python3-pytest
BuildRequires: python3-devel python3-setuptools python3-sphinx python3-pytest python3-furo
%description
A network address manipulation library for Python
@ -36,6 +34,10 @@ Based on Python3 network address representation and operation library Package
sed -i 's/\r//' netaddr/*.py netaddr/ip/*.py netaddr/eui/*.idx
find netaddr -name "*.py" | xargs sed -i -e '1 {/^#!\//d}'
# elimate key words in python-netaddr: REPUBLIC OF CHINA, ROC, R.O.C., etc
sed -i "s/, R.O.C//g;s/Peoples Republic of China/People's Republic of China/g" netaddr/eui/iab.txt
sed -i "s/TAIWAN,ROC/TAIWAN/g;s/Taiwan ROC./Taiwan/g;s/TAIWAN R.O.C./TAIWAN/g;s/Hsin-Chu R.O.C./Hsin-Chu Taiwan/g;s/Taiwan, R.O.C./Taiwan/g;s/Taiwan(R.O.C)/Taiwan/g;s/Taiwan R.O.C/Taiwan/g;s/Taiwan (R.O.C.)/Taiwan/g;s/Taiwan, R.O.C/Taiwan/g;s/TAIWAN 30077 R.O.C.//g;s/TAIWAN 231 R.O.C.//g;s/TAIWAN ROC/TAIWAN/g;s/TAIWAN R. O. C./TAIWAN/g;s/Taiwan, R. O. C./TAIWAN/g;s/, REPUBLIC OF CHINA//g;s/TAIWAN 222 R.O.C.//g;s/ R.O.C.//g;s/, R.O.C//g;s/ (R.O.C)//g;s/,R.O.C//g;s/ R.O.C//g;s/ (R.O.C.)//g;s/ ROC/ TAIWAN/g;s/ ,REPUBLIC OF CHINA//g;s/ ,REPUBLIC OF CHINA//g;s/Taiwan ROC//g" netaddr/eui/oui.txt
%build
%py3_build
@ -58,6 +60,9 @@ py.test-%{python3_version}
%{_bindir}/netaddr
%changelog
* Sun Feb 04 2024 wangkai <13474090681@163.com> - 0.10.1-1
- Update to 0.10.1
* Tue Jun 13 2023 zhangpan <zhangpan103@h-partners.com> - 0.8.0-6
- delete taboo words