rules 2.94 KB
Newer Older
1 2
#!/usr/bin/make -f

Jeremy Sanders's avatar
Jeremy Sanders committed
3 4 5 6
export CFLAGS=$(shell dpkg-buildflags --get CFLAGS)
export CPPFLAGS=$(shell dpkg-buildflags --get CPPFLAGS)
export LDFLAGS=$(shell dpkg-buildflags --get LDFLAGS)

7
# Get the supported Python versions
8
PY3VERS = $(shell py3versions -r -v)
9 10 11
PYVERS = $(shell pyversions -r -v)

# Callable functions to determine the correct PYTHONPATH
12 13 14 15 16
# (pyinstaller moved from pythonX.Y ->cpython[23] - this is for compatibility)
pythonpath = $$(ls -d $(CURDIR)/.pybuild/pythonX.Y_$(1)/build \
	$(CURDIR)/.pybuild/cpython[23]_$(1)/build)
pythonpath_dbg = $$(ls -d $(CURDIR)/.pybuild/pythonX.Y-dbg_$(1)/build \
	$(CURDIR)/.pybuild/cpython[23]_""$(1)""_dbg/build)
17 18 19 20 21 22 23

# examples are not installed, and scripts are only installed by python3
install_args = --veusz-resource-dir=debian/tmp/usr/share/veusz --disable-install-examples
export PYBUILD_INSTALL_ARGS_python2 = --install-scripts=/dev/null $(install_args)
export PYBUILD_INSTALL_ARGS_python2-dbg = --install-scripts=/dev/null $(install_args)
export PYBUILD_INSTALL_ARGS_python3 = $(install_args)
export PYBUILD_INSTALL_ARGS_python3-dbg = --install-scripts=/dev/null $(install_args)
24

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

28 29
override_dh_auto_build: export http_proxy=127.0.0.1:9
override_dh_auto_build: export https_proxy=127.0.0.1:9
Jeremy Sanders's avatar
Jeremy Sanders committed
30
override_dh_auto_build: delete_generated
31
	dh_auto_build
32

33 34 35 36 37 38 39 40
# desktop files are copied from source package
	cp -p support/veusz.desktop debian/
	cp -p support/veusz.xml debian/veusz.sharedmimeinfo

# regenerate docs
	PYTHONPATH=. sphinx-build -N -bhtml Documents/manual-source build/html
	pod2man --release=`cat VERSION` --center="Veusz"  Documents/man-page/veusz.pod build/veusz.1

41 42
override_dh_auto_install:
# do not install examples and put data files in /usr/share/veusz
43
	dh_auto_install
44

45
# veusz follows symlink to find its resources
46
	for py in $(PYVERS); do \
47 48 49 50
		dh_link -ppython-veusz usr/share/veusz usr/lib/python$${py}/dist-packages/veusz/resources; \
	done
	for py in $(PY3VERS); do \
		dh_link -ppython3-veusz usr/share/veusz usr/lib/python$${py}/dist-packages/veusz/resources; \
51 52 53
	done

	dh_numpy
54
	dh_numpy3
55
	dh_sip
56
	dh_sip3
57

58 59 60
override_dh_auto_test:
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
	set -e -x;\
61
	for py in $(PYVERS) $(PY3VERS); do \
62
		PYTHONPATH=$(call pythonpath,$$py) \
63
			VEUSZ_RESOURCE_DIR=. \
64
			xvfb-run -a \
65 66
			--server-args "-screen 0 640x480x24" \
			python$$py tests/runselftest.py ;\
67
		PYTHONPATH=$(call pythonpath_dbg,$$py) \
68
			VEUSZ_RESOURCE_DIR=. \
69
			xvfb-run -a \
70 71 72 73 74
			--server-args "-screen 0 640x480x24" \
			python$$py-dbg tests/runselftest.py ;\
	done
endif

75
override_dh_strip:
76 77
	dh_strip -ppython-veusz.helpers --dbg-package=python-veusz.helpers-dbg
	dh_strip -ppython3-veusz.helpers --dbg-package=python3-veusz.helpers-dbg
78 79 80 81

override_dh_compress:
# don't compress Veusz example files
	dh_compress -X.vsz
82

Jeremy Sanders's avatar
Jeremy Sanders committed
83
override_dh_clean: delete_generated
84
	dh_clean
Jeremy Sanders's avatar
Jeremy Sanders committed
85 86 87

delete_generated:
# delete files generated by rules
88
	rm -f debian/veusz.sharedmimeinfo debian/veusz.desktop