File: rules

package info (click to toggle)
python-numpy 1:1.16.2-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 25,116 kB
  • sloc: ansic: 158,812; python: 115,039; cpp: 1,112; makefile: 502; sh: 314; f90: 289; sed: 140; fortran: 121; perl: 68
file content (167 lines) | stat: -rwxr-xr-x 7,517 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#!/usr/bin/make -f

DH_VERBOSE=1

PY2VERS=$(shell pyversions -vr debian/control)
PY3VERS=$(shell py3versions -vr)
PYDEF=$(shell pyversions -dv)
PY3DEF=$(shell py3versions -dv)
PYLIBPATH := $(shell python -c "from distutils.command.build import build ; from distutils.core import Distribution ; b = build(Distribution()) ; b.finalize_options() ; print b.build_platlib")
PY3LIBPATH := $(shell python3 -c "from distutils.command.build import build ; from distutils.core import Distribution ; b = build(Distribution()) ; b.finalize_options() ; print (b.build_platlib)")

# Look at #634012 to understand why is needed and what will happen if we set
# compat to 9
unexport LDFLAGS
export ATLAS=None

%:
	dh $@ --with python2,python3

override_dh_auto_build:
	cd numpy/random/mtrand && python generate_mtrand_c.py
	dh_auto_build
	set -e; for v in $(PY3VERS); do \
		python$$v setup.py build; \
		python$$v-dbg setup.py build; \
	done

	# build doc only for default python version
	(export MPLCONFIGDIR=. ; make -C doc html PYTHON=python3 PYTHONPATH=../$(PY3LIBPATH))

override_dh_auto_clean:
	rm -rf build/
	rm -rf `find -name build -type d`
	rm -rf `find . -name "*.pyc" -type f`
	rm -rf doc/fontList.cache numpy/f2py/docs/usersguide/index.html
	rm -rf doc/source/reference/generated
	# cython generated
	rm -f numpy/random/mtrand/mtrand.c

#override_dh_installman:
#	dh_installman -ppython-numpy doc/f2py/f2py.1
#	dh_installman -ppython3-numpy doc/f2py/f2py.1
#	-mv debian/python3-numpy/usr/share/man/man1/f2py.1 \
#	  debian/python3-numpy/usr/share/man/man1/f2py3.1
#	# link manpage for versioned and dbg incarnations of f2py
#	set -e; for v in $(PY2VERS); do \
#		dh_link -ppython-numpy /usr/share/man/man1/f2py.1.gz /usr/share/man/man1/f2py$$v.1.gz; \
#		dh_link -ppython-numpy-dbg /usr/share/man/man1/f2py.1.gz /usr/share/man/man1/f2py$$v-dbg.1.gz; \
#	done
#	set -e; for v in $(PY3VERS); do \
#		dh_link -ppython3-numpy /usr/share/man/man1/f2py3.1.gz /usr/share/man/man1/f2py$$v.1.gz; \
#		dh_link -ppython3-numpy-dbg /usr/share/man/man1/f2py3.1.gz /usr/share/man/man1/f2py$$v-dbg.1.gz; \
#	done
#	dh_link -ppython-numpy-dbg /usr/share/man/man1/f2py.1.gz /usr/share/man/man1/f2py-dbg.1.gz;
#	dh_link -ppython3-numpy-dbg /usr/share/man/man1/f2py3.1.gz /usr/share/man/man1/f2py3-dbg.1.gz;

override_dh_install:
	# add shebang information to f2py script
	set -e; for v in $(PY2VERS) $(PY3VERS); do \
		sed -i "1s,#!.*python[^ ]*\(.*\),#!/usr/bin/python$$v," debian/tmp/usr/bin/f2py$$v; \
		cp -a debian/tmp/usr/bin/f2py$$v debian/tmp/usr/bin/f2py$$v-dbg ; \
		sed -i "1s,#!.*python[^ ]*\(.*\),#!/usr/bin/python$$v-dbg," debian/tmp/usr/bin/f2py$$v-dbg; \
	done
	# install unversioned f2py script
	cp -a debian/tmp/usr/bin/f2py$(PYDEF) debian/tmp/usr/bin/f2py
	sed -i "1s,#!.*python[^ ]*\(.*\),#!/usr/bin/python," debian/tmp/usr/bin/f2py
	cp -a debian/tmp/usr/bin/f2py$(PYDEF)-dbg debian/tmp/usr/bin/f2py-dbg
	sed -i "1s,#!.*python[^ ]*\(.*\),#!/usr/bin/python-dbg," debian/tmp/usr/bin/f2py-dbg

	cp -a debian/tmp/usr/bin/f2py$(PY3DEF) debian/tmp/usr/bin/f2py3
	sed -i "1s,#!.*python[^ ]*\(.*\),#!/usr/bin/python3," debian/tmp/usr/bin/f2py3
	cp -a debian/tmp/usr/bin/f2py$(PY3DEF)-dbg debian/tmp/usr/bin/f2py3-dbg
	sed -i "1s,#!.*python[^ ]*\(.*\),#!/usr/bin/python3-dbg," debian/tmp/usr/bin/f2py3-dbg

	dh_install

	# remove files installed from .install (that's due to the dir listed there)
	-find $(CURDIR)/debian/python-numpy/ -name "*_d.so" -delete

	# create symlinks for .h files
	dh_link -ppython-numpy usr/lib/python$(PYDEF)/dist-packages/numpy/core/include/numpy usr/include/numpy;
	set -e; for i in $(PY2VERS); do \
	[ -d $(CURDIR)/debian/python-numpy/usr/include/python$$i ] || \
		mkdir -p $(CURDIR)/debian/python-numpy/usr/include/python$$i; \
		dh_link -ppython-numpy usr/lib/python$$i/dist-packages/numpy/core/include/numpy usr/include/python$$i/numpy; \
	done
	set -e; for i in $(PY2VERS); do \
	[ -d $(CURDIR)/debian/python-numpy-dbg/usr/include/python$${i}_d ] || \
		mkdir -p $(CURDIR)/debian/python-numpy-dbg/usr/include/python$${i}_d; \
		dh_link -ppython-numpy-dbg usr/lib/python$$i/dist-packages/numpy/core/include/numpy usr/include/python$${i}_d/numpy; \
	done
	# Python 3
	set -e; for i in $(PY3VERS); do \
	ABITAG=`python$$i -c "import sys; print(sys.abiflags)"`; \
	[ -d $(CURDIR)/debian/python3-numpy/usr/include/python$$i$$ABITAG ] || \
		mkdir -p $(CURDIR)/debian/python3-numpy/usr/include/python$$i$$ABITAG; \
		dh_link -ppython3-numpy usr/lib/python3/dist-packages/numpy/core/include/numpy usr/include/python$$i$$ABITAG/numpy; \
	done
	set -e; for i in $(PY3VERS); do \
	ABITAG=`python$$i-dbg -c "import sys; print(sys.abiflags)"`; \
	[ -d $(CURDIR)/debian/python3-numpy-dbg/usr/include/python$${i}$$ABITAG ] || \
		mkdir -p $(CURDIR)/debian/python3-numpy-dbg/usr/include/python$${i}$$ABITAG; \
		dh_link -ppython3-numpy-dbg usr/lib/python3/dist-packages/numpy/core/include/numpy/ usr/include/python$${i}$$ABITAG/numpy; \
	done

	# share -dbg and normal package doc dirs
	rm -rf debian/python-numpy-dbg/usr/share/doc/python-numpy-dbg
	dh_link -ppython-numpy-dbg usr/share/doc/python-numpy usr/share/doc/python-numpy-dbg
	rm -rf debian/python3-numpy-dbg/usr/share/doc/python3-numpy-dbg
	dh_link -ppython3-numpy-dbg usr/share/doc/python3-numpy usr/share/doc/python3-numpy-dbg

override_dh_gencontrol:
	python debian/versions.helper >> debian/python-numpy.substvars
	python debian/versions3.helper >> debian/python3-numpy.substvars
	dh_gencontrol

override_dh_compress:
	dh_compress -X.js -Xobjects.inv -X.txt

override_dh_strip:
ifeq (,$(filter nostrip,$(DEB_BUILD_OPTIONS)))
	dh_strip -ppython-numpy --dbg-package=python-numpy-dbg
	dh_strip -ppython3-numpy --dbg-package=python3-numpy-dbg
	# dh_strip seemingly doesn't catch the PEP 3149-style debug names
	rm debian/python3-numpy/usr/lib/python3*/*-packages/*/*/*.cpython-3?d*.so
endif


override_dh_installdocs-indep:
	dh_installdocs -i
	dh_sphinxdoc -i

update_intersphinx_mapping:
	wget http://docs.python.org/dev/objects.inv -O debian/python.org_objects.inv

override_dh_auto_install:
	dh_auto_install

	# Install for Python 3
	set -e; for v in $(PY3VERS); do \
		python$$v setup.py install --root=$(CURDIR)/debian/tmp --install-layout=deb; \
		python$$v-dbg setup.py install --root=$(CURDIR)/debian/tmp --install-layout=deb; \
	done

	# yes, we need to run tests after install
	# The reason is that numpy tries hard to not let you run it from the
	# source directory, so we need to mess with the import order so to
	# select the code in the installation path
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
	set -e; for v in $(PY2VERS) ; do \
		cd debian ; \
		echo "-- running tests for "$$v" plain --" ; \
		python$$v -c "import sys ; sys.path.insert(0, './tmp/usr/lib/python$$v/dist-packages/') ; import numpy; numpy.test(verbose=5)" ; \
		echo "-- running tests for "$$v" debug --" ; \
		python$$v-dbg -c "import sys ; sys.path.insert(0, './tmp/usr/lib/python$$v/dist-packages/') ; import numpy; numpy.test(verbose=5)" ; \
		cd .. ; \
	done
	# Python 3.2 maps to python3/ dir alone? bah
	set -e; for v in $(PY3VERS) ; do \
		cd debian ; \
		echo "-- running tests for "$$v" plain --" ; \
		python$$v -c "import sys ; sys.path.insert(0, './tmp/usr/lib/python3/dist-packages/') ; import numpy; numpy.test(verbose=5)" ; \
		echo "-- running tests for "$$v" debug --" ; \
		python$$v-dbg -c "import sys ; sys.path.insert(0, './tmp/usr/lib/python3/dist-packages/') ; import numpy; numpy.test(verbose=5)" ; \
		cd .. ; \
	done
endif