[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#739840: python-netaddr: python3 shebang



* Vincent Bernat <bernat@debian.org>, 2014-02-23, 08:57:
/usr/bin/netaddr has "#! /usr/bin/python" shebang, as expected. But when I rebuilt the package from source, the binary ended up with "#! /usr/bin/python3" shebang.

This is not the first time I get this when I have both a Python 2.x and a Python 3 packages. The last time, I fixed this by inverting the sections in debian/control.

Eww!

Is there a better solution?

Looking at my build log, debian/rules called

		python setup.py install \
		--root="/build/python-netaddr-c_G4Pi/python-netaddr-0.7.10/debian/tmp/" \
		--install-purelib=/usr/lib/python2.7/site-packages/ \
--prefix=/usr --no-compile -O0
and later

		python3 setup.py install \
		--root="/build/python-netaddr-c_G4Pi/python-netaddr-0.7.10/debian/tmp/" \
		--install-purelib=/usr/lib/python3.3/site-packages/ \
--prefix=/usr --no-compile -O0 I doubt that cdbs guarantees any particular order of these two calls. Even if it did, it's still insufficient to get deterministic shebang: distutils won't overwrite files if they have identical[0] timestamps.

How to fix this? There are many possibilities:

1) Make sure that both “setup.py install” calls are made in the correct order, and that the last uses the --force[1] option.

2) Don't install both to the same directory, but rather install each one to its own debian/$pkgname/.

If you take advantage of the fact that Python 2 and Python 3 versions of the script vary only with shebang (no 2to3 involved), you have even more options:

3) Pass --executable[2] to “setup.py build”.

4) Fix shebang using dh_python2's --shebang.

5) Fix shebang using sed.

I can't offer help with implementing any of the above options, because I don't know cdbs. Sorry!


[0] Resolution for the timestamp check is 1 second. :(
http://bugs.python.org/issue18027
[1] --force (-f)       force installation (overwrite any existing files)
[2] --executable (-e)  specify final destination interpreter path (build.py)

--
Jakub Wilk


Reply to: