Imported Upstream version 0.70
SVN-Git Migration
8 years ago
0 | Authors | |
1 | ======= | |
2 | ||
3 | Maximillian Dornseif <md AT hudora.de> | |
4 | > IPy author and maintainer until the version 0.42 | |
5 | Victor Stinner <victor.stinner AT inl.fr> | |
6 | > new maintainer since the version 0.5 | |
7 | ||
8 | Contributors | |
9 | ============ | |
10 | ||
11 | Aras Vaichas <arasv AT magtech.com.au> | |
12 | > fix __getitem__ for IP object of size 1 | |
13 | Bernhard Frauendienst <contact AT obeliks.de> | |
14 | > fix IPv6 parser | |
15 | James Teh <james.teh AT netboxblue.com> | |
16 | > make_net option patch | |
17 | Jean Gillaux <jgillaux AT inl.fr> | |
18 | > fix netmask "/0.0.0.0" | |
19 | Mark Johnston | |
20 | > bringing IPy to Python 2.3 | |
21 | Matthew Flanagan <mattimustang AT gmail.com> | |
22 | > fix strCompressed() | |
23 | Robert Nickel <rnickel AT scea.com> | |
24 | > fix setup.py bdist_rpm | |
25 | Samuel Krempp | |
26 | > fix __cmp__() bug | |
27 | Shell, Hin-lik Hung | |
28 | > bring IPy to OpenBSD ports | |
29 | Skinny Puppy | |
30 | > __add__() now always returns a value | |
31 | William McVey <wam AT cisco.com> | |
32 | > Fix IP.__nonzero__() | |
33 |
0 | Copyright (c) 2006, INL | |
1 | Copyright (c) 2001-2005, Maximillian Dornseif | |
2 | All rights reserved. | |
3 | Redistribution and use in source and binary forms, with or without | |
4 | modification, are permitted provided that the following conditions are met: | |
5 | ||
6 | * Redistributions of source code must retain the above copyright | |
7 | notice, this list of conditions and the following disclaimer. | |
8 | * Redistributions in binary form must reproduce the above copyright | |
9 | notice, this list of conditions and the following disclaimer in the | |
10 | documentation and/or other materials provided with the distribution. | |
11 | * Neither the name of IPy nor the names of its contributors may be used | |
12 | to endorse or promote products derived from this software without | |
13 | specific prior written permission. | |
14 | ||
15 | THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY | |
16 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
18 | DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY | |
19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
25 |
0 | Version 0.70 (2009-10-29) | |
1 | * New "major" version because it may break compatibility | |
2 | * Fix __cmp__(): IP('0.0.0.0/0') and IP('0.0.0.0') are not equal | |
3 | * Fix IP.net() of the network "::/0": "::" instead of "0.0.0.0". | |
4 | IPy 0.63 should fix this bug, but it wasn't. | |
5 | ||
0 | 6 | Version 0.64 (2009-08-19) |
1 | 7 | * Create MANIFEST.in to fix setup.py bdist_rpm, fix by Robert Nickel |
2 | 8 | |
3 | 9 | Version 0.63 (2009-06-23) |
4 | 10 | * Fix formatting of "IPv4 in IPv6" network, eg. IP('::ffff:192.168.10.0/120'), |
5 | 11 | the netmask ("/120" in the example) was missing! |
6 | * Fix IP.net() of the network "::/0": "::" instead of "0.0.0.0" | |
7 | 12 | |
8 | 13 | Version 0.62 (2008-07-15) |
9 | 14 | * Fix reverse DNS of IPv6 address: use ".ip6.arpa." suffix instead of |
19 | 24 | ouput is smarter with IPv6 address |
20 | 25 | * Remove check_addr_prefixlen because it generates invalid IP address |
21 | 26 | |
22 | 2008-02-05 | |
23 | * Release IPy 0.56 | |
24 | * Fix IPv6 parser for unit tests: reject | |
25 | '1111::2222:3333:4444:5555:6666:7777:8888' address since '::' is | |
26 | useless | |
27 | ||
28 | 2007-08-16 | |
29 | * Release IPy 0.55 | |
30 | * Rewrite IPv6 parser to allow address "1:2:3:4:5:6::" | |
31 | ||
32 | 2007-06-22 | |
33 | * Release IPy 0.54 | |
34 | * make_net() match from James Teh: transform an IP address into a network | |
35 | address by applying the given netmask | |
36 | ||
37 | 2007-02-28 | |
38 | * Release IPy 0.53 | |
39 | * Reject '0.0.0.0-0.0.0.4' if check_addr_prefixlen is enable | |
40 | * Fix many english spelling mistakes | |
41 | ||
42 | 2006-11-06 | |
43 | * Release IPy 0.52 | |
44 | * Fix strCompressed() for IPv6 "ffff:ffff:ffff:ffff:ffff:f:f:fffc/127" | |
45 | ||
46 | 2006-11-02 | |
47 | * Release IPy 0.51 | |
48 | * Write real name of IPy author (Maximillian Dornseif) | |
49 | * Use version "0.51" to help packaging since 0.5 was smaller than 0.42 | |
50 | * Fix unit test for Python 2.3 (don't use doctest.testfile) and 2.5 | |
51 | (problem of hex() lower case) | |
52 | * "make test" also check IPy documentation | |
53 | * IPy now works on Python 2.2 to 2.5 | |
54 | ||
55 | 2006-10-26 | |
56 | * Release IPy 0.5 | |
57 | * Apply Jean Gillaux patch for netmask "/0.0.0.0" bug | |
58 | * Apply William McVey patch for __nonzero__() bug | |
59 | * Apply Victor Stinner patch: setup.py can use setuptools and fix URLs | |
60 | * Allow "172.30.1.0/22" with new option IPy.check_addr_prefixlen=False | |
61 | * Add regression tests | |
62 | * Create AUTHORS file | |
63 | ||
64 | 2004-08-22 | |
65 | * IPy 0.42 works on Python 2.3 without warnings | |
66 | ||
67 | 2002-01-16 | |
68 | * IPy 0.41 has Python < 2.2 compatible unit tests and a README file | |
69 | ||
70 | 2001-12-22 | |
71 | * IPy 0.4 was the first public relase |
5 | 5 | http://software.inl.fr/trac/trac.cgi/wiki/IPy |
6 | 6 | """ |
7 | 7 | |
8 | # $HeadURL: https://svn.inl.fr/inl-svn/src/tools/ipy/trunk/IPy.py $ | |
9 | # $Id: IPy.py 19001 2009-08-19 08:09:28Z haypo $ | |
10 | ||
11 | __rcsid__ = '$Id: IPy.py 19001 2009-08-19 08:09:28Z haypo $' | |
12 | __version__ = '0.64' | |
8 | # $HeadURL: https://svn.inl.fr/inl-svn/src/tools/ipy/tags/IPy-0.70/IPy.py $ | |
9 | # $Id: IPy.py 19309 2009-10-29 10:21:13Z haypo $ | |
10 | ||
11 | __rcsid__ = '$Id: IPy.py 19309 2009-10-29 10:21:13Z haypo $' | |
12 | __version__ = '0.70' | |
13 | 13 | |
14 | 14 | import types |
15 | 15 | |
683 | 683 | return -1 |
684 | 684 | elif self.ip > other.ip: |
685 | 685 | return 1 |
686 | elif self._ipversion != other._ipversion: | |
687 | # IP('0.0.0.0'), IP('::/0') | |
688 | return cmp(self._ipversion, other._ipversion) | |
686 | 689 | else: |
687 | 690 | return 0 |
688 | 691 | |
718 | 721 | >>> IP('10.0.0.0/8').net() |
719 | 722 | IP('10.0.0.0') |
720 | 723 | """ |
721 | return IP(IPint.net(self)) | |
724 | return IP(IPint.net(self), ipversion=self._ipversion) | |
722 | 725 | |
723 | 726 | def broadcast(self): |
724 | 727 | """Return the broadcast (last) address of a network as an IP object. |
0 | 0 | Metadata-Version: 1.0 |
1 | 1 | Name: IPy |
2 | Version: 0.64 | |
2 | Version: 0.70 | |
3 | 3 | Summary: Class and tools for handling of IPv4 and IPv6 addresses and networks |
4 | 4 | Home-page: http://software.inl.fr/trac/trac.cgi/wiki/IPy |
5 | 5 | Author: Victor Stinner |
180 | 180 | What's new |
181 | 181 | ========== |
182 | 182 | |
183 | Version 0.70 (2009-10-29) | |
184 | * New "major" version because it may break compatibility | |
185 | * Fix __cmp__(): IP('0.0.0.0/0') and IP('0.0.0.0') are not equal | |
186 | * Fix IP.net() of the network "::/0": "::" instead of "0.0.0.0". | |
187 | IPy 0.63 should fix this bug, but it wasn't. | |
188 | ||
183 | 189 | Version 0.64 (2009-08-19) |
184 | 190 | * Create MANIFEST.in to fix setup.py bdist_rpm, fix by Robert Nickel |
185 | 191 | |
186 | 192 | Version 0.63 (2009-06-23) |
187 | 193 | * Fix formatting of "IPv4 in IPv6" network, eg. IP('::ffff:192.168.10.0/120'), |
188 | 194 | the netmask ("/120" in the example) was missing! |
189 | * Fix IP.net() of the network "::/0": "::" instead of "0.0.0.0" | |
190 | 195 | |
191 | 196 | Version 0.62 (2008-07-15) |
192 | 197 | * Fix reverse DNS of IPv6 address: use ".ip6.arpa." suffix instead of |
201 | 206 | * Use strCompressed() instead of strFullsize() to format IP addresses, |
202 | 207 | ouput is smarter with IPv6 address |
203 | 208 | * Remove check_addr_prefixlen because it generates invalid IP address |
204 | ||
205 | 2008-02-05 | |
206 | * Release IPy 0.56 | |
207 | * Fix IPv6 parser for unit tests: reject | |
208 | '1111::2222:3333:4444:5555:6666:7777:8888' address since '::' is | |
209 | useless | |
210 | ||
211 | 2007-08-16 | |
212 | * Release IPy 0.55 | |
213 | * Rewrite IPv6 parser to allow address "1:2:3:4:5:6::" | |
214 | ||
215 | 2007-06-22 | |
216 | * Release IPy 0.54 | |
217 | * make_net() match from James Teh: transform an IP address into a network | |
218 | address by applying the given netmask | |
219 | ||
220 | 2007-02-28 | |
221 | * Release IPy 0.53 | |
222 | * Reject '0.0.0.0-0.0.0.4' if check_addr_prefixlen is enable | |
223 | * Fix many english spelling mistakes | |
224 | ||
225 | 2006-11-06 | |
226 | * Release IPy 0.52 | |
227 | * Fix strCompressed() for IPv6 "ffff:ffff:ffff:ffff:ffff:f:f:fffc/127" | |
228 | ||
229 | 2006-11-02 | |
230 | * Release IPy 0.51 | |
231 | * Write real name of IPy author (Maximillian Dornseif) | |
232 | * Use version "0.51" to help packaging since 0.5 was smaller than 0.42 | |
233 | * Fix unit test for Python 2.3 (don't use doctest.testfile) and 2.5 | |
234 | (problem of hex() lower case) | |
235 | * "make test" also check IPy documentation | |
236 | * IPy now works on Python 2.2 to 2.5 | |
237 | ||
238 | 2006-10-26 | |
239 | * Release IPy 0.5 | |
240 | * Apply Jean Gillaux patch for netmask "/0.0.0.0" bug | |
241 | * Apply William McVey patch for __nonzero__() bug | |
242 | * Apply Victor Stinner patch: setup.py can use setuptools and fix URLs | |
243 | * Allow "172.30.1.0/22" with new option IPy.check_addr_prefixlen=False | |
244 | * Add regression tests | |
245 | * Create AUTHORS file | |
246 | ||
247 | 2004-08-22 | |
248 | * IPy 0.42 works on Python 2.3 without warnings | |
249 | ||
250 | 2002-01-16 | |
251 | * IPy 0.41 has Python < 2.2 compatible unit tests and a README file | |
252 | ||
253 | 2001-12-22 | |
254 | * IPy 0.4 was the first public relase | |
255 | 209 | Keywords: ipv4 ipv6 netmask |
256 | 210 | Platform: UNKNOWN |
257 | 211 | Classifier: Development Status :: 5 - Production/Stable |
0 | #!/usr/bin/env python | |
1 | import doctest | |
2 | import sys | |
3 | if hasattr(doctest, "testfile"): | |
4 | print "=== Test file: README ===" | |
5 | failure, tests = doctest.testfile('README', optionflags=doctest.ELLIPSIS) | |
6 | if failure: | |
7 | sys.exit(1) | |
8 | ||
9 | print "=== Test file: test.rst ===" | |
10 | failure, tests = doctest.testfile('test/test.rst', optionflags=doctest.ELLIPSIS) | |
11 | if failure: | |
12 | sys.exit(1) | |
13 | ||
14 | print "=== Test IPy module ===" | |
15 | import IPy | |
16 | failure, tests = doctest.testmod(IPy) | |
17 | if failure: | |
18 | sys.exit(1) | |
19 | else: | |
20 | sys.stderr.write("WARNING: doctest has no function testfile (before Python 2.4), unable to check README\n") | |
21 |