#!/usr/bin/make -f # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 include /usr/share/python/python.mk # Python default library and script directories LIB := $(shell python -c "from distutils.command.build import build ; from distutils.core import Distribution ; b = build(Distribution()) ; b.finalize_options() ; print b.build_purelib") SCRIPT := $(shell python -c "from distutils.command.build import build ; from distutils.core import Distribution ; b = build(Distribution()) ; b.finalize_options() ; print b.build_scripts") LIB3 := $(shell python3 -c "from distutils.command.build import build ; from distutils.core import Distribution ; b = build(Distribution()) ; b.finalize_options() ; print (b.build_purelib)") SCRIPT3 := $(shell python3 -c "from distutils.command.build import build ; from distutils.core import Distribution ; b = build(Distribution()) ; b.finalize_options() ; print (b.build_scripts)") %: dh $@ --with python2,python3 override_dh_auto_build: # python module build NO_SETUPTOOLS=1 python setup.py build NO_SETUPTOOLS=1 python3 setup.py build # we need this hack because we have to import "logilab.common.pytest" # and for doc generation, but since it's a namespace package, # we need to "simulate" it touch $(CURDIR)/$(LIB)/logilab/__init__.py # build doc $(MAKE) -C doc # remove dummy file rm -f $(CURDIR)/$(LIB)/logilab/__init__.py override_dh_auto_test: ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),) # we need this hack because we have to import "logilab.common.pytest" # and for doc generation, but since it's a namespace package, # we need to "simulate" it touch $(CURDIR)/$(LIB)/logilab/__init__.py touch $(CURDIR)/$(LIB3)/logilab/__init__.py # run tests # use the default python version to select the script dir to run the tests -PYTHONPATH=$(CURDIR)/$(LIB)/ $(CURDIR)/$(SCRIPT)/logilab-pytest -t $(CURDIR)/test -PYTHONPATH=$(CURDIR)/$(LIB3)/ $(CURDIR)/$(SCRIPT3)/logilab-pytest -t $(CURDIR)/test # remove dummy file rm -f $(CURDIR)/$(LIB)/logilab/__init__.py rm -f $(CURDIR)/$(LIB3)/logilab/__init__.py endif override_dh_auto_clean: # clean doc $(MAKE) -C doc clean NO_SETUPTOOLS=1 python setup.py clean NO_SETUPTOOLS=1 python3 setup.py clean find . -name "*.pyc" -delete dh_clean override_dh_auto_install: build NO_SETUPTOOLS=1 python setup.py install --no-compile \ --root=$(CURDIR)/debian/python-logilab-common/ \ ${py_setup_install_args} NO_SETUPTOOLS=1 python3 setup.py install --no-compile \ --root=$(CURDIR)/debian/python3-logilab-common/ \ ${py_setup_install_args} # move logilab-pytest to logilab-pytest3 for py3k package mv debian/python3-logilab-common/usr/bin/logilab-pytest debian/python3-logilab-common/usr/bin/logilab-pytest3 # remove __pycache__ dirs find $(CURDIR)/debian/python3-logilab-common -type d -name "__pycache__" | xargs rm -rf # remove test directory rm -rf debian/python-logilab-common/usr/lib/python*/*-packages/logilab/common/test rm -rf debian/python3-logilab-common/usr/lib/python*/*-packages/logilab/common/test override_dh_installchangelogs: dh_installchangelogs ChangeLog override_dh_installdocs: dh_installdocs README doc/apidoc/ override_dh_installman: dh_installman # install the manpage for the py3k package cp doc/logilab-pytest.1 doc/logilab-pytest3.1 dh_installman -p python3-logilab-common doc/logilab-pytest3.1 rm doc/logilab-pytest3.1 override_dh_compress: dh_compress -X.py -X.ini -X.xml -Xtest/ -Xapidoc/