On 14.12.2015 20:18, Jérémie Courrèges-Anglas wrote:
> [email protected] (Jérémie Courrèges-Anglas) writes:
>
>> Daniel Jakots <[email protected]> writes:
>>
>>> Hi,
>>>
>>> I wanted to add a py3 flavor to net/py-ripe.atlas.tools which depends
>>> on net/py-ripe.atlas.sagan wich itself depends on py-IP, hence this
>>> diff.
>>>
>>> I only tried py-ripe.atlas.tools so please test it, thanks.
>>
>> As I said the tests fail with python3.4 on i386:
>>
>> https://pbot.rmdir.de/3I3_OxgyBOqIqgR3KtBWLw
>>
>> The reason is that IPy.IP() defines a __nonzero__() method, but python
>> 3 tries to use __bool__() instead, falling back to __len__(). Adding
>> a __bool__ method fixes the regress tests, but the len() method
>> remains broken on 32 bits, using python2.7 or python3.4.
>
> So here's a diff including the mentioned fix. It should be reported
> upstream, mentioning the len() problem would be worth it too.
>
> Benoit, ok?
Sorry for the delay, yes sure !
>
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/net/py-IP/Makefile,v
> retrieving revision 1.30
> diff -u -p -r1.30 Makefile
> --- Makefile 11 Apr 2015 11:54:05 -0000 1.30
> +++ Makefile 14 Dec 2015 19:18:31 -0000
> @@ -6,6 +6,7 @@ MODPY_EGG_VERSION = 0.83
> DISTNAME = IPy-${MODPY_EGG_VERSION}
> PKGNAME = py-IP-${MODPY_EGG_VERSION}
> CATEGORIES = net
> +REVISION = 0
>
> HOMEPAGE = https://github.com/haypo/python-ipy/wiki
>
> @@ -17,6 +18,9 @@ PERMIT_PACKAGE_CDROM = Yes
> MODPY_PI = Yes
>
> MODULES = lang/python
> +
> +FLAVORS = python3
> +FLAVOR ?=
>
> MODPY_DISTUTILS_INSTALLARGS = -O2
>
> Index: patches/patch-IPy_py
> ===================================================================
> RCS file: patches/patch-IPy_py
> diff -N patches/patch-IPy_py
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-IPy_py 14 Dec 2015 19:18:31 -0000
> @@ -0,0 +1,17 @@
> +$OpenBSD$
> +--- IPy.py.orig Mon Dec 14 13:28:56 2015
> ++++ IPy.py Mon Dec 14 13:44:43 2015
> +@@ -558,6 +558,13 @@ class IPint(object):
> + """
> + return True
> +
> ++ def __bool__(self):
> ++ """All IPy objects should evaluate to true in boolean context.
> ++ Ordinarily they do, but if handling a default route expressed as
> ++ 0.0.0.0/0, the __len__() of the object becomes 0, which is used
> ++ as the boolean value of the object.
> ++ """
> ++ return True
> +
> + def __len__(self):
> + """
> Index: pkg/PLIST
> ===================================================================
> RCS file: /cvs/ports/net/py-IP/pkg/PLIST,v
> retrieving revision 1.4
> diff -u -p -r1.4 PLIST
> --- pkg/PLIST 1 Oct 2009 20:13:11 -0000 1.4
> +++ pkg/PLIST 14 Dec 2015 19:18:31 -0000
> @@ -1,5 +1,6 @@
> @comment $OpenBSD: PLIST,v 1.4 2009/10/01 20:13:11 benoit Exp $
>
> lib/python${MODPY_VERSION}/site-packages/IPy-${MODPY_EGG_VERSION}-py${MODPY_VERSION}.egg-info
> lib/python${MODPY_VERSION}/site-packages/IPy.py
> -lib/python${MODPY_VERSION}/site-packages/IPy.pyc
> -lib/python${MODPY_VERSION}/site-packages/IPy.pyo
> +${MODPY_COMMENT}lib/python${MODPY_VERSION}/site-packages/${MODPY_PYCACHE}/
> +lib/python${MODPY_VERSION}/site-packages/${MODPY_PYCACHE}IPy.${MODPY_PYC_MAGIC_TAG}pyc
> +lib/python${MODPY_VERSION}/site-packages/${MODPY_PYCACHE}IPy.${MODPY_PYC_MAGIC_TAG}pyo
>
>