Compare commits
10 Commits
65a15a588d
...
9b8135bcf8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9b8135bcf8 | ||
|
|
08867a8b6b | ||
|
|
98faacdecf | ||
|
|
1a2a0442b9 | ||
|
|
d5eff64cc9 | ||
|
|
cddb3163bf | ||
|
|
efe99c3a27 | ||
|
|
070a6f14c5 | ||
|
|
1a7cd93a41 | ||
|
|
a36305c0fd |
@ -1,33 +0,0 @@
|
||||
From 29c6ebe53f02a5dba4f4d397b5a5d69682fe5471 Mon Sep 17 00:00:00 2001
|
||||
From: Jeff Ferland <jeff@storyinmemo.com>
|
||||
Date: Tue, 30 Apr 2013 16:05:33 -0700
|
||||
Subject: [PATCH 03/35] Revert "IPSet doesn't **need** MutableSet inheritance.
|
||||
Try/catch it."
|
||||
|
||||
This reverts commit 4d6fbf91a50a2ebc24ff01d3406232d1666677ec.
|
||||
We can't make IPSet work without various collections, so just use them all.
|
||||
---
|
||||
IPy.py | 7 +------
|
||||
1 file changed, 1 insertion(+), 6 deletions(-)
|
||||
|
||||
diff --git a/IPy.py b/IPy.py
|
||||
index 0e17aab..60f7a43 100644
|
||||
--- a/IPy.py
|
||||
+++ b/IPy.py
|
||||
@@ -1016,12 +1016,7 @@ class IP(IPint):
|
||||
raise ValueError("%s cannot be converted to an IPv4 address."
|
||||
% repr(self))
|
||||
|
||||
-try:
|
||||
- IPSetBaseClass = collections.MutableSet
|
||||
-except AttributeError:
|
||||
- IPSetBaseClass = object
|
||||
-
|
||||
-class IPSet(IPSetBaseClass):
|
||||
+class IPSet(collections.MutableSet):
|
||||
def __init__(self, iterable=[]):
|
||||
# Make sure it's iterable, otherwise wrap
|
||||
if not isinstance(iterable, collections.Iterable):
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
@ -1,67 +0,0 @@
|
||||
From 55149cb1eecb486c2ea8a2170f7e58ae1b815e15 Mon Sep 17 00:00:00 2001
|
||||
From: Jeff Ferland <jeff@storyinmemo.com>
|
||||
Date: Wed, 27 Feb 2019 14:45:30 -0800
|
||||
Subject: [PATCH 34/35] (#57) obey explicit version for small int as string
|
||||
|
||||
---
|
||||
IPy.py | 8 ++++----
|
||||
test/test_IPy.py | 3 +++
|
||||
2 files changed, 7 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/IPy.py b/IPy.py
|
||||
index 99c9196..486ad44 100644
|
||||
--- a/IPy.py
|
||||
+++ b/IPy.py
|
||||
@@ -243,7 +243,7 @@ class IPint(object):
|
||||
else:
|
||||
raise ValueError("can't parse")
|
||||
|
||||
- (self.ip, parsedVersion) = parseAddress(ip)
|
||||
+ (self.ip, parsedVersion) = parseAddress(ip, ipversion)
|
||||
if ipversion == 0:
|
||||
ipversion = parsedVersion
|
||||
if prefixlen == -1:
|
||||
@@ -1341,7 +1341,7 @@ def _parseAddressIPv6(ipstr):
|
||||
index += 1
|
||||
return value
|
||||
|
||||
-def parseAddress(ipstr):
|
||||
+def parseAddress(ipstr, ipversion=0):
|
||||
"""
|
||||
Parse a string and return the corresponding IP address (as integer)
|
||||
and a guess of the IP version.
|
||||
@@ -1410,7 +1410,7 @@ def parseAddress(ipstr):
|
||||
# assume IPv6 in pure hexadecimal notation
|
||||
return (hexval, 6)
|
||||
|
||||
- elif ipstr.find('.') != -1 or (intval is not None and intval < 256):
|
||||
+ elif ipstr.find('.') != -1 or (intval is not None and intval < 256 and ipversion != 6):
|
||||
# assume IPv4 ('127' gets interpreted as '127.0.0.0')
|
||||
bytes = ipstr.split('.')
|
||||
if len(bytes) > 4:
|
||||
@@ -1428,7 +1428,7 @@ def parseAddress(ipstr):
|
||||
# will be interpreted as IPv4 first byte
|
||||
if intval > MAX_IPV6_ADDRESS:
|
||||
raise ValueError("IP Address can't be larger than %x: %x" % (MAX_IPV6_ADDRESS, intval))
|
||||
- if intval <= MAX_IPV4_ADDRESS:
|
||||
+ if intval <= MAX_IPV4_ADDRESS and ipversion != 6:
|
||||
return (intval, 4)
|
||||
else:
|
||||
return (intval, 6)
|
||||
diff --git a/test/test_IPy.py b/test/test_IPy.py
|
||||
index d363d0e..dc4b61f 100644
|
||||
--- a/test/test_IPy.py
|
||||
+++ b/test/test_IPy.py
|
||||
@@ -891,6 +891,9 @@ class RegressionTest(unittest.TestCase):
|
||||
self.assertEqual(len(IPy.IP('192.168.0.0/24')), 256)
|
||||
self.assertRaises(ValueError, IPy.IP, '192.168.1.0/42')
|
||||
|
||||
+ def testConsistentIP6StrInt(self):
|
||||
+ self.assertEqual(IPy.IP('11', ipversion=6), IPy.IP(11, ipversion=6))
|
||||
+
|
||||
class TestConstrutor(unittest.TestCase):
|
||||
def testCheckAddrPrefixlenOff(self):
|
||||
self.assertRaises(ValueError, IPy.IP, 0xffffffff + 1, ipversion=4)
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
BIN
IPy-0.81.tar.gz
BIN
IPy-0.81.tar.gz
Binary file not shown.
BIN
IPy-1.00.tar.gz
BIN
IPy-1.00.tar.gz
Binary file not shown.
BIN
IPy-1.01.tar.gz
Normal file
BIN
IPy-1.01.tar.gz
Normal file
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
Name: IPy
|
||||
Version: 1.00
|
||||
Release: 0
|
||||
Name: python-IPy
|
||||
Version: 1.01
|
||||
Release: 2
|
||||
Summary: Class and Tools for Handling of IPv4 and IPv6 Addresses and Networks
|
||||
License: BSD
|
||||
URL: https://github.com/autocracy/python-ipy
|
||||
@ -8,13 +8,7 @@ Source0: https://pypi.python.org/packages/source/I/IPy/IPy-%{version}.t
|
||||
|
||||
|
||||
BuildArch: noarch
|
||||
%if 0%{?with_python2}
|
||||
BuildRequires: python2-devel python2-setuptools
|
||||
%endif
|
||||
|
||||
%if 0%{?with_python3}
|
||||
BuildRequires: python3-devel python3-setuptools
|
||||
%endif
|
||||
|
||||
%description
|
||||
The IP class allows a comfortable parsing and handling for most notations
|
||||
@ -23,17 +17,6 @@ by RIPE's Perl module NET::IP's interface but doesn't share the
|
||||
implementation. It doesn't share non-CIDR netmasks, so funky stuff like a
|
||||
netmask of 0xffffff0f can't be done here.
|
||||
|
||||
%if 0%{?with_python2}
|
||||
%package -n python2-IPy
|
||||
Summary: Python2 package for python-IPy
|
||||
Provides: python-IPy = %{version}-%{release}
|
||||
Obsoletes: python-IPy < %{version}-%{release}
|
||||
|
||||
%description -n python2-IPy
|
||||
Python2 package for python-IPy
|
||||
%endif
|
||||
|
||||
%if 0%{?with_python3}
|
||||
%package -n python3-IPy
|
||||
Summary: Python3 package for python-IPy
|
||||
%{?python_provide: %python_provide python3-IPy}
|
||||
@ -42,57 +25,36 @@ Obsoletes: %{name}-python3
|
||||
|
||||
%description -n python3-IPy
|
||||
Python3 package for python-IPy
|
||||
%endif
|
||||
|
||||
%prep
|
||||
%autosetup -n python-ipy-IPy-%{version} -p1
|
||||
%autosetup -n IPy-%{version} -p1
|
||||
|
||||
%build
|
||||
%if 0%{?with_python2}
|
||||
%py2_build
|
||||
%endif
|
||||
|
||||
%if 0%{?with_python3}
|
||||
%py3_build
|
||||
%endif
|
||||
|
||||
%install
|
||||
%if 0%{?with_python2}
|
||||
%py2_install
|
||||
%endif
|
||||
|
||||
%if 0%{?with_python3}
|
||||
%py3_install
|
||||
%endif
|
||||
|
||||
%check
|
||||
%if 0%{?with_python2}
|
||||
PYTHONPATH=$PWD %{__python2} test/test_IPy.py
|
||||
PYTHONPATH=$PWD %{__python2} test_doc.py
|
||||
%endif
|
||||
|
||||
%if 0%{?with_python3}
|
||||
PYTHONPATH=$PWD %{__python3} test/test_IPy.py
|
||||
#PYTHONPATH=$PWD %{__python3} test_doc.py # FAILS
|
||||
%endif
|
||||
|
||||
%if 0%{?with_python2}
|
||||
%files -n python2-IPy
|
||||
%defattr(-,root,root)
|
||||
%license COPYING
|
||||
%doc AUTHORS
|
||||
%{python2_sitelib}/*
|
||||
%endif
|
||||
|
||||
%if 0%{?with_python3}
|
||||
%files -n python3-IPy
|
||||
%defattr(-,root,root)
|
||||
%license COPYING
|
||||
%doc AUTHORS
|
||||
%{python3_sitelib}/*
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Mon May 23 2022 dongyuzhen <dongyuzhen@h-partners.com> - 1.01-2
|
||||
- fix Name in spec file
|
||||
|
||||
* Sat Jan 30 2021 jinzhimin <jinzhimin2@huawei.com> - 1.01-1
|
||||
- Upgrade to 1.01
|
||||
|
||||
* Fri Oct 30 2020 jinzhimin <jinzhimin2@huawei.com> - 1.00-1
|
||||
- remove python2-IPy subpackage
|
||||
|
||||
* Thu Jul 23 2020 openEuler Buildteam <buildteam@openeuler.org> - 1.00-0
|
||||
- update package to 1.00
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user