python-3.xdebiandebsoftware-packagingdebhelper

debhelper instructed to use python3, but runs setup.py with python2


I am struggling with dh to create package for python 3 (and not for python 2). I use setup.py which, when called with python3, builds for python 3. I have a separate debian directory for py3k, so I want to build just for that version.

debian/rules looks like this:

export DH_VERBOSE=1
%:
    dh $@ --with python3

and debian/control has all the usual stuff, including X-Python3-Version:

Source: woo
Maintainer: Václav Šmilauer <eu@doxos.eu>
Section: python
Priority: optional
Build-Depends: python3-setuptools (>= 0.6b3), python3-all, python3-all-dev, debhelper (>= 7.4.3), libboost-all-dev, pyqt4-dev-tools, libqt4-dev, libqt4-dev-bin, qt4-dev-tools, libgle3-dev, libqglviewer-qt4-dev | libqglviewer-dev, libvtk5-dev, libgts-dev, libeigen3-dev, freeglut3-dev
X-Python3-Version: >= 3.4
Standards-Version: 3.9.1

Package: python3-woo
Architecture: any
Depends: ${misc:Depends}, ${python3:Depends}, ${shlibs:Depends}, python3-xlrd, python3-xlwt, python3-numpy, python3-matplotlib, python3-colorama, python3-qt4, python3-xlib, python3-genshi, python3-psutil, python3-minieigen, python3-imaging, python3-h5py, python3-lockfile, ipython3, mencoder | libav-tools | ffmpeg, python3-prettytable
Description: Discrete dynamic compuations, esp. granular mechanics (python 3)
 ...

Now when I run fakeroot debian/rules binary, setup.py is run with python rather than python3, despite --with python3:

$ fakeroot debian/rules binary
dh binary --with python3
   dh_auto_build
pyversions: missing X(S)-Python-Version in control file, fall back to debian/pyversions
pyversions: missing debian/pyversions file, fall back to supported versions
    python setup.py build --force
[...]

What's the problem?


Solution

  • The solution was to add --buildsystem=pybuild to debian/rules, so that it looks like this:

    %:
        dh $@ --with python3 --buildsystem=pybuild