File: rules

package info (click to toggle)
dipy 0.5.0-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 4,780 kB
  • sloc: python: 10,563; makefile: 218; pascal: 138
file content (99 lines) | stat: -rwxr-xr-x 3,483 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
#!/usr/bin/make -f
# -*- makefile -*-

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

# default Python
PYTHON=$(shell pyversions -d)
PYVER=$(shell pyversions -d -v)

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 )

%:
	dh --buildsystem=python_distutils $@

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

override_dh_auto_build:
	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"; \
		PYTHONPATH=$$(/bin/ls -d $(INSTALL_PATH)/usr/lib/$$PYTHON/*-packages) \
		MPLCONFIGDIR=/tmp/ \
			$$PYTHON /usr/bin/nosetests 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
	: # 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