summaryrefslogtreecommitdiff
path: root/debian/rules
blob: ff53d7b6e7c9debeccf1151c3e48734c90b200f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export POCL_CACHE_DIR=$(CURDIR)/.cache/
export PYBUILD_AFTER_INSTALL=rm -rf {destdir}/usr/bin/
export PYBUILD_NAME=silx
export SPECFILE_USE_GNU_SOURCE=1

# Make does not offer a recursive wildcard function, so here's one:
rwildcard=$(wildcard $1$2) $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2))

# How to recursively find all files with the same name in a given folder
ALL_PYX := $(call rwildcard,silx/,*.pyx)
#NOTA: No space before *

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

override_dh_clean:
	dh_clean
	# remove the cython generated file to force rebuild
	rm -f $(patsubst %.pyx,%.cpp,${ALL_PYX})
	rm -f $(patsubst %.pyx,%.c,${ALL_PYX})
	rm -f $(patsubst %.pyx,%.html,${ALL_PYX})
	rm -rf doc/build/html
	rm -rf build/man
	rm -rf *.egg-info
	rm -rf $(POCL_CACHE_DIR)

override_dh_auto_build:
	dh_auto_build
	# build man pages
	dh_auto_build -- -s custom --build-args="env PYTHONPATH={build_dir} {interpreter} setup.py build_man"

override_dh_install:
	dh_numpy
	dh_numpy3

	# install scripts into silx
	python3 setup.py install_scripts -d debian/silx/usr/bin

	# install the qtdesigner files only for the python3 package
	dh_install -p python3-silx qtdesigner_plugins/*.py /usr/lib/qt4/plugins/designer/python

	dh_install

# WITH_QT_TEST=False to disable graphical tests
# SILX_OPENCL=False to disable OpenCL tests
# SILX_TEST_LOW_MEM=True to disable tests taking large amount of memory
# GPU=False to disable the use of a GPU with OpenCL test
# WITH_GL_TEST=False to disable tests using OpenGL
# UNACTIVATED UNTIL dh_python from UNSTABLE IS FIXED
# https://lists.debian.org/debian-python/2017/08/msg00095.html
override_dh_auto_test:
#	mkdir -p $(POCL_CACHE_DIR) # create POCL cachedir in order to avoid an FTBFS in sbuild
#	dh_auto_test -- -s custom --test-args="env PYTHONPATH={build_dir} GPU=False SILX_OPENCL=False SILX_TEST_LAW_MEM=True xvfb-run -a --server-args=\"-screen 0 1024x768x24\" {interpreter} run_tests.py -vv --installed"

override_dh_installman:
	dh_installman -p silx build/man/*.1

override_dh_sphinxdoc:
ifeq (,$(findstring nodocs, $(DEB_BUILD_OPTIONS)))
	mkdir -p $(POCL_CACHE_DIR) # create POCL cachedir in order to avoid an FTBFS in sbuild
	pybuild --build -s custom -p 3.6 --build-args="cd doc && env PYTHONPATH={build_dir} http_proxy='127.0.0.1:9' {interpreter} -m sphinx -N -bhtml source build/html"
	dh_installdocs "doc/build/html" -p python-silx-doc
	dh_sphinxdoc -O--buildsystem=pybuild
endif