debian/rules
author Denis Laxalde <denis.laxalde@logilab.fr>
Fri, 11 Oct 2019 16:53:52 +0200
branchstable
changeset 4913 cac7e750422f
parent 4911 ddfc0b16c9d7
child 5294 29f3680823e9
permissions -rwxr-xr-x
debian: also build with python3 We build with Python 3 along with Python 2. The binary package will contain the extension for both python version. This is to ease transition until the mercurial package in Debian uses Python 3. The documentation is still built with Python 2 because it needs Mercurial (which is currently Python 2).

#!/usr/bin/make -f
#export DH_VERBOSE=1

%:
	dh $@ --with python2,python3,sphinxdoc --buildsystem=pybuild

ifeq (,$(filter nodoc, $(DEB_BUILD_OPTIONS)))
override_dh_auto_build:
	dh_auto_build
	# Workaround for Sphinx in Debian Buster defaulting to Python 3
	SPHINXBUILD="python -m sphinx -bhtml" $(MAKE) -C docs
endif

hgsrc_defined:
	# Use "! -z" instead of "-n", because "-n" without arguments is true
	test ! -z $(HGSRC) && test -d $(HGSRC) || (echo "$(HGSRC) is not a directory"; false)

ifeq (,$(filter nocheck, $(DEB_BUILD_OPTIONS)))
override_dh_auto_test: hgsrc_defined
	cd tests && python $(HGSRC)/tests/run-tests.py --with-hg=$(HGSRC)/hg --blacklist=$(CURDIR)/debian/test-blacklist
endif

override_dh_python2:
	# avoid conflict with mercurial's own hgext3rd/__init__.py
	find debian -path '*/hgext3rd/__init__.py' -delete
	dh_python2

override_dh_python3:
	# avoid conflict with mercurial's own hgext3rd/__init__.py
	find debian -path '*/hgext3rd/__init__.py' -delete
	dh_python3

override_dh_auto_clean: clean-docs
	dh_auto_clean
	rm -f tests/*.err

clean-docs:
	rm -rf html
	rm -f docs/static/logo-evolve.ico
	rm -f docs/tutorials/tutorial.rst
	rm -f docs/tutorials/topic-tutorial.rst