File: rules

package info (click to toggle)
dipy 0.7.1-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 43,276 kB
  • ctags: 9,823
  • sloc: python: 22,407; makefile: 260; pascal: 155; sh: 15; ansic: 11
file content (142 lines) | stat: -rwxr-xr-x 4,904 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#!/usr/bin/make -f
# -*- makefile -*-

PACKAGE_NAME = python-dipy
PACKAGE_ROOT_DIR = debian/${PACKAGE_NAME}
INSTALL_PATH = $(CURDIR)/debian/tmp

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

# default Python
PYTHON=$(shell pyversions -d)
PYVERS = $(shell pyversions -vr)
PYVER = $(shell pyversions -vd)
PY3VERS = $(shell py3versions -vr)
PY3VER = $(shell py3versions -vd)

srcpkg = $(shell LC_ALL=C dpkg-parsechangelog | grep '^Source:' | cut -d ' ' -f 2,2)
debver = $(shell LC_ALL=C dpkg-parsechangelog | grep '^Version:' | cut -d ' ' -f 2,2 )
upver = $(shell echo $(debver) | cut -d '-' -f 1,1 )

MIN_CYTHONVER = 0.17.3

%:
	dh --buildsystem=python_distutils $@

clean_generated:
	find dipy -iname *.c | xargs grep -l -e 'Generated by Cython' | xargs -r rm -f
	rm -f pyx-stamps

_cythonize%:
	debian/rules clean_generated # force removal of previous copies
	make build-stamp-source && \
	D=debian/cythonized-files$(*:2=) && \
		git rm -rf $$D; \
		find dipy/ -name *.c | while read f; do \
			grep -q 'Generated by Cython' "$$f" || continue; \
			mkdir -p "$$D/$$(dirname $$f)"; \
			cp "$$f" "$$D/$$(dirname $$f)"; \
			git add -f "$$D/$$f"; \
		done; \
		cp pyx-stamps $$D/; \
		echo "$(upver)" >| $$D/VERSION; \
		git add -f $$D/VERSION $$D/pyx-stamps


_uncythonize%:
	echo "D: HERE"
	echo "$*" | grep -q '^3' && PY=3 || PY= ; \
	CYTHONVER=$$(dpkg -l cython$$PY 2>/dev/null | awk '/^ii/{print $$3;}' || echo 0); \
	dpkg --compare-versions "$$CYTHONVER" lt "$(MIN_CYTHONVER)" && { \
		echo "I: Using pre-Cython-ed files for Python $*"; \
		cd debian/cythonized-files$$PY/ ; \
		find . -name *.c | while read f; do cp $$f ../../$$f; done; \
		cp pyx-stamps ../../; } || :

cythonize: _cythonize2 # _cythonize3

override_dh_auto_test:
	: # Do not test just after build, lets install and then test

override_dh_auto_build: _uncythonize2
	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 (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	: # Copy pregenerated examples
	cp -rp doc-examples/doc/examples_built/* doc/examples_built/
	export PYTHONPATH=$$(/bin/ls -d $(INSTALL_PATH)/usr/lib/$(PYTHON)/*-packages) \
		   MPLCONFIGDIR=$(CURDIR)/build HOME=$(CURDIR)/build; \
	cd doc; $(MAKE) html-after-examples
	-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
endif

	: # Run tests later on
	: # cd build to prevent use of local/not-built source tree
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	cd build; \
	for PYTHON in $(shell pyversions -r); do \
		echo "I: Running Dipy unittests using $$PYTHON"; \
        PATH=$(INSTALL_PATH)/usr/bin:$$PATH \
		PYTHONPATH=$$(/bin/ls -d $(INSTALL_PATH)/usr/lib/$$PYTHON/*-packages) \
		MPLCONFIGDIR=/tmp/ \
			$$PYTHON /usr/bin/nosetests -sv --exclude test_peaksFromModelParallel dipy; \
	done
endif

override_dh_pysupport:
	: # I: Move libraries into the -lib and -lib-dbg packages
	find $(PACKAGE_ROOT_DIR)/ -iname *.so -delete || :  # remove .so from indep pkg if present
	find $(INSTALL_PATH)/ -iname *.so | \
	  while read so; do \
	    d=$$(dirname $$so); \
		if [ $${so%_d.so} = $${so} ]; then suf=""; else suf="-dbg"; fi; \
	    d=$$(echo $$d | sed -e "s,$(INSTALL_PATH)/,$(PACKAGE_ROOT_DIR)-lib$$suf/,g"); \
	    mkdir -p $$d; echo "Moving $$so under $$d"; mv $$so $$d; \
	  done
	dh_pysupport

## 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

get-orig-source:
	-quilt pop -a
	uscan --verbose --download-current
#	: # I Testing for uncommited changes
#	@git diff --quiet HEAD
#	: # I Composing main tarball
#	mkdir -p tarballs
#	git archive --format=tar --prefix=$(srcpkg)-$(upver)/ HEAD \
#	| gzip -9 > ../tarballs/$(srcpkg)_$(upver).orig.tar.gz
#	: # I Building examples figures and tarball
#	python setup.py build
#	export PYTHONPATH=$$(/bin/ls -d $(CURDIR)/build/lib.*$(PYVER)); \
#		cd doc; $(MAKE) examples-tgz
#	mv dist/dipy-*-doc-examples.tar.gz ../tarballs/$(srcpkg)_$(upver).orig-doc-examples.tar.gz
	wget -O ../tarballs/$(srcpkg)_$(upver).orig-doc-examples.tar.gz \
		http://nipy.sourceforge.net/dipy/dipy-$(upver)-doc-examples.tar.gz
	: # Symlinking back into build-area for git-buildpackage not supporting multi-tarball atm
	[ -d ../build-area ] && ln -sf ../tarballs/$(srcpkg)_$(upver).orig*.tar.gz ../build-area

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