#! /usr/bin/make -f %: dh $@ --with python2,python3 export LC_ALL := C.UTF-8 PY2REQUESTED := $(shell pyversions -r) PY2DEFAULT := $(shell pyversions -d) PY3REQUESTED := $(shell py3versions -r) PY3DEFAULT := $(shell py3versions -d) # Run setup.py with the default python/python3 last so that the scripts use # #!/usr/bin/python(3) and not #!/usr/bin/pythonX.Y. PY2 := $(filter-out $(PY2DEFAULT),$(PY2REQUESTED)) python PY3 := $(filter-out $(PY3DEFAULT),$(PY3REQUESTED)) python3 override_dh_auto_build: dh_auto_build set -e; for python in $(PY3); do \ $$python setup.py build; \ done ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) override_dh_auto_test: set -e; for python in $(PY2) $(PY3); do \ $$python setup.py test; \ done endif override_dh_auto_clean: dh_auto_clean rm -rf build override_dh_auto_install: # setuptools likes to leave some debris around, which confuses things. find build -name \*.pyc -print0 | xargs -0r rm -f find build -name __pycache__ -print0 | xargs -0r rm -rf find build -name \*.egg-info -print0 | xargs -0r rm -rf dh_auto_install # Allow the Python 3 top-level scripts to take priority. set -e; for python in $(PY3); do \ $$python setup.py install --force --root=$(CURDIR)/debian/tmp \ --no-compile -O0 --install-layout=deb; \ done override_dh_python2: dh_python2 -ppython-germinate