File: rules

package info (click to toggle)
dipy 1.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 15,196 kB
  • sloc: python: 64,639; makefile: 264; pascal: 167; sh: 132; ansic: 106
file content (115 lines) | stat: -rwxr-xr-x 3,797 bytes parent folder | download
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/usr/bin/make -f
# -*- makefile -*-

export PYBUILD_NAME=dipy

PACKAGE3_NAME = python3-$(PYBUILD_NAME)

PACKAGE3_ROOT_DIR = debian/${PACKAGE3_NAME}
INSTALL_PATH = $(CURDIR)/debian/tmp

ifeq (,$(findstring get-orig-source, $(MAKECMDGOALS)))
export  http_proxy=http://127.0.0.1:9/
endif

# default Python
PY3VERS = $(shell py3versions -vr)
PY3VER = $(shell py3versions -vd)

include /usr/share/dpkg/default.mk
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

MIN_CYTHONVER = 0.25.1

BUILD_DATE := "$(date --utc --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%B %d, %Y)"
SPHINXOPTS := -D today=\"$(BUILD_DATE)\"

%:
	dh $@ --buildsystem=pybuild --with python3

override_dh_auto_clean:
	dh_auto_clean || true
	rm -rf .pybuild __pycache__

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	: # Do not test just after build, lets install and then test
endif

override_dh_auto_build:
	chmod 0644 doc/examples/*.py
	dh_auto_build
	echo "backend : Agg" >| build/matplotlibrc

override_dh_auto_install:
	dh_auto_install
	: # Prune duplicate LICENSE file
	find debian/ -name LICENSE -delete
	: # Only now lets build docs
ifeq (python-dipy-doc_,$(filter python-dipy-doc,$(shell dh_listpackages))_$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	export PYTHONPATH=$(shell pybuild --print build_dir --interpreter python3) \
		   MPLCONFIGDIR=$(CURDIR)/build HOME=$(CURDIR)/build; \
	cd doc; $(MAKE) html-after-examples SPHINXOPTS="$(SPHINXOPTS)"
	-rm doc/_build/html/_static/jquery.js
	-rm -r doc/_build/html/_sources
	: # objects inventory is of no use for the package
	-rm doc/_build/html/objects.inv
	# references to cloudflare and github are privacy breaches
	sed 's@https://cdnjs\.cloudflare\.com/ajax/libs/mathjax/[^/]\+/@file:///usr/share/javascript/mathjax/unpacked/@' \
		-i doc/_build/html/*.html \
		   doc/_build/html/interfaces/*.html \
		   doc/_build/html/theory/*.html
	# FIXME: references to github are for images part of dipy_data, which
	# is not available in debian; these may need packaging to solve the
	# privacy breach here.
endif
	# Run tests later on
	# cd build to prevent use of local/not-built source tree
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	set -x ; \
	export http_proxy=http://127.0.0.1:9/ ; \
	export https_proxy=https://127.0.0.1:9/ ; \
	for PYTHON in $(PY3VERS); do \
	    export PYTHONPATH=$$(pybuild --print build_dir --interpreter python$$PYTHON); \
	    echo "I: Running Dipy unittests using $$PYTHON"; \
	    cd build; \
	    PATH=$(INSTALL_PATH)/usr/bin:$$PATH \
	        HOME=/tmp \
		MPLCONFIGDIR=/tmp/ xvfb-run -a -s "-screen 0 1280x1024x24 -noreset" \
			python$$PYTHON /usr/bin/nosetests3 -sv --exclude 'test_(peaksFromModelParallel|fetcher)' dipy; \
	    cd .. ; \
	done
endif

## move .so libraries into -lib package, and call dh_numpy*
## while removing 2 if not present
_dh_python%:
	set -e \
	; test -d debian/$(PACKAGE$*_NAME)/usr/lib || exit 0 \
	; for lib in $$(find debian/$(PACKAGE$*_NAME)/usr/lib -name "*.so") \
	; do	sdir=$$(dirname $$lib) \
	;	tdir=debian/$(PACKAGE$*_NAME)-lib/$${sdir#*$(PACKAGE$*_NAME)/} \
	;	mkdir -p "$${tdir}" \
	;	mv -v "$${lib}" "$${tdir}" \
	; done
	[ -e /usr/bin/dh_numpy$(*:2=) ] && dh_numpy$(*:2=) -p$(PACKAGE$*_NAME)-lib || :
	dh_python$*

## "Instantiate" both rules so dh sees them
override_dh_python3: _dh_python3

## immediately useable documentation
## and exemplar data (they are small excerpts anyway)
override_dh_compress:
	dh_compress -X.py -X.html -X.css -X.jpg -X.txt -X.js -X.json -X.rtc -X.par -X.bin -Xobjects.inv

override_dh_clean:
	: # I: Custom cleaning
	rm -rf build doc-stamp
	$(MAKE) -C doc clean
	dh_clean

inject-doc-examples:
	mkdir -p doc-examples
	tar -C doc-examples --strip-components 1 \
	 -xzvf ../tarballs/$(DEB_SOURCE)_$(DEB_VERSION_UPSTREAM).orig-doc-examples.tar.gz