#!/usr/bin/make -f # See debhelper(7) (uncomment to enable) # output every command that modifies files on the build system. export DH_VERBOSE = 1 export DEB_BUILD_MAINT_OPTIONS = hardening=+bindnow export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed include /usr/share/dpkg/pkg-info.mk PYTHON3_VERSIONS = $(shell py3versions -r) py3sdo = set -e; $(foreach py, $(PYTHON3_VERSIONS), $(py) $(1);) %: dh $@ --with python3,sphinxdoc --buildsystem=pybuild override_dh_auto_test: -cp --no-clobber $$(find ./build/ -name '*.so') poezio/ LC_ALL=C.UTF-8 PYTHONPATH=. pytest-3 test/ override_dh_auto_clean: $(call py3sdo, setup.py clean) override_dh_auto_build: $(call py3sdo, setup.py build) # Build the documentation with Sphinx for Python 3 and access to a # binary extension module built under build/lib.*. cp --no-clobber $$(find ./build/ -name '*.so') poezio/ rm -rf doc/source/theme/sphinx_rtd_theme ln -s /usr/share/sphinx_rtd_theme/ doc/source/theme/ PYTHONPATH=. http_proxy='127.0.0.1:9' \ /usr/share/sphinx/scripts/python3/sphinx-build \ doc/source build/html override_dh_auto_install: $(call py3sdo, setup.py install --root=$(CURDIR)/debian/$(DEB_SOURCE) --install-layout=deb) # Remove unwanted files # Directory /usr/share/poezio only contains: # * a license file (redundant with debian/copyright); # * a changelog (already installed in /usr/share/doc/poezio); # * a README file (already installed in /usr/share/doc/poezio). rm -rf debian/poezio/usr/share/poezio # We are building and installing the HTML documentation, which # already includes the source RST documentation rm -rf debian/poezio/usr/share/doc/poezio/source # We do not need gnupg.py, which is provided in package python3-gnupg rm -f debian/poezio/usr/lib/python3/dist-packages/poezio_plugins/gpg/gnupg.py # Move binary libraries to the binary package for library in debian/poezio/usr/lib/python*/dist-packages/poezio/*.so ; \ do \ short_path="$${library#debian/poezio/}" ; \ short_dir="$${short_path%/*}" ; \ if [ ! -e "debian/python3-poezio-poopt/$$short_dir" ] ; \ then \ mkdir -p "debian/python3-poezio-poopt/$$short_dir" ; \ fi ; \ mv "$$library" "debian/python3-poezio-poopt/$$short_dir" ; \ done override_dh_python3: dh_python3 --shebang=/usr/bin/python3 execute_before_dh_clean: rm -rf $$(find -type d -name __pycache__)