File: rules

package info (click to toggle)
nipy 0.4.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 13,128 kB
  • sloc: python: 45,886; ansic: 30,932; makefile: 253; sh: 53
file content (106 lines) | stat: -rwxr-xr-x 3,309 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
#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-

export DH_VERBOSE=1

debver = $(shell LC_ALL=C dpkg-parsechangelog | grep '^Version:' | cut -d ' ' -f 2,2 )
uver = $(shell echo $(debver) | sed -e 's,-[^-]*$$,,g' )

PYVER = $(shell pyversions -vd)

# To fix distutils fragile nature: when seing LDFLAGS=, which is set
# by dpkg-buildpackage it stops providing -shared flag, so for the
# minimalistic fix (alternative to NMU-ed #535699 with explicit
# -shared) we just unexport LDFLAGS
unexport LDFLAGS

# Mega rule
%:
	dh $@ --buildsystem=python_distutils --with=python2

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

manpages:
	@echo "I: generating manpages"
	set -e; mkdir -p build/manpages && \
	cd scripts && for f in *; do \
		descr=$$(grep -h -e "^ *'''" -e 'DESCRIP =' $$f | sed -e "s,.*' *\([^'][^']*\)'.*,\1,g" | head -n 1); \
        PYTHONPATH=../ \
		help2man -n "$$descr" --no-discard-stderr --no-info --version-string "$(uver)" "python ./$$f" \
		>| ../build/manpages/$$f.1; \
	done

#
# Documentation
#
doc-stamp:
	: # I: Generate documentation
	export PYTHONPATH=$$PWD/`/bin/ls -d build/lib.*$(PYVER)` \
           PATH=$(CURDIR)/debian/tmp/usr/bin/:$$PATH \
		   MPLCONFIGDIR=$(CURDIR)/build HOME=$(CURDIR)/build; \
     cd doc; $(MAKE) html
	: # I: Use jquery from Debian package
	-rm doc/build/html/_static/jquery.js
	touch $@


#override_dh_auto_install:
#	dh_auto_install

test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	: # I: Unittest only the default python version for now against "installed" materials
	cd debian; \
     PATH=$(CURDIR)/debian/tmp/usr/bin/:$$PATH \
	 PYTHONPATH=$$(/bin/ls -d $(CURDIR)/debian/tmp/usr/lib/python$(PYVER)/*-packages):$$PYTHONPATH \
     MPLCONFIGDIR=$(CURDIR)/build \
	  ../tools/nipnost nipy
else
	: # Skip unittests due to nocheck
endif

override_dh_install: test
	: # I: Move libraries into the python-nipy-lib and -lib-dbg packages
	find debian/tmp/ -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,debian/tmp/,debian/python-nipy-lib$$suf/,g"); \
	    mkdir -p $$d; echo "Moving $$so under $$d"; mv $$so $$d; \
	  done
	: # I: Move leftovers into python-nipy
	mkdir -p debian/python-nipy
	mv debian/tmp/* debian/python-nipy/
	: # I: Fix up interpreter which might be -dbg one
	sed -i -e 's,/usr/bin/python-dbg,/usr/bin/python,g' debian/python-nipy/usr/bin/*
	: # I: Assure versioned dependency on NumPy
	if [ -x /usr/bin/dh_numpy ]; then dh_numpy;	fi

	dh_install
	-rm debian/python-nipy-doc/usr/share/javascript/underscore/underscore.js


## immediately useable documentation and exemplar scripts/data
override_dh_compress:
	: # I: Avoiding compression of what should not be compressed
	dh_compress -X.py -X.html -X.pdf -X.css -X.jpg -X.txt -X.js -X.json -X.rtc -Xobjects.inv

override_dh_installman: manpages
	dh_installman -ppython-nipy build/manpages/*.1

override_dh_clean:
	: # I: Custom cleaning
	rm -rf build doc-stamp nipy/neurospin/__config__.py
	$(MAKE) -C doc clean
	dh_clean


# We build documentation only for -indep
binary-indep: doc-stamp

binary: binary-arch binary-indep