From f736a51b0332776b7ca2b9a79a807c67a8e746dd Mon Sep 17 00:00:00 2001 From: thianda Date: Wed, 20 Jan 2021 09:48:30 +0800 Subject: [PATCH] Release 1.02 Fix a bug: last_ip can't be compressed --- ChangeLog | 4 ++++ IPy.py | 9 +++++++-- README.rst | 2 +- setup.py | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 58baa4f..31e70db 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Version 1.02 (2021-01-20) +------------ + * Fix a bug: `last_ip` can't be compressed + Version 1.01 (2020-12-01) ------------ * Update to support up to Python 3.9 diff --git a/IPy.py b/IPy.py index 3cddf29..1ad42ce 100644 --- a/IPy.py +++ b/IPy.py @@ -6,7 +6,7 @@ https://github.com/haypo/python-ipy """ -__version__ = '1.01' +__version__ = '1.02' import bisect import types @@ -403,7 +403,12 @@ def strCompressed(self, wantprefixlen = None): hextets.append('') if compressionpos == 0: hextets = [''] + hextets - return ':'.join(hextets) + self._printPrefix(wantprefixlen) + # fix the bug: `last_ip` can't be compressed + if wantprefixlen == 3: + _last = "-%s" % (IPint(self.ip + self.len() - 1).strCompressed()) + else: + _last = self._printPrefix(wantprefixlen) + return ':'.join(hextets) + _last else: return self.strNormal(0) + self._printPrefix(wantprefixlen) diff --git a/README.rst b/README.rst index eb236cc..d852d95 100644 --- a/README.rst +++ b/README.rst @@ -177,7 +177,7 @@ unique address ranges and will aggregate overlapping ranges. :: Compatibility and links ======================= -IPy 1.01 works on Python version 2.6 - 3.7. +IPy 1.02 works on Python version 2.6 - 3.7. The IP module should work in Python 2.5 as long as the subtraction operation is not used. IPSet requires features of the collecitons class which appear diff --git a/setup.py b/setup.py index 9bd2f8d..51d7fe5 100755 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ import sys from distutils.core import setup -VERSION = '1.01' +VERSION = '1.02' options = {}