Debian Codegraph @

debian/rules

raw
1 #!/usr/bin/make -f
2
3 include /usr/share/dpkg/architecture.mk
4 include /usr/share/dpkg/pkg-info.mk
5
6 # Large file support actually works, but some buildds and Salsa do not like us
7 # creating 5 GB files.
8 SKIP_TESTS = \
9 test_big_arrays \
10 test_large_file_support \
11 test_configtool
12 # Some tests have architecture-specific issues. Generally, these are related to
13 # unexpected behavior of floating point operations (unexpected for the unit
14 # tests, that is).
15 ifneq ($(filter armel armhf,$(DEB_HOST_ARCH)),)
16 SKIP_TESTS += \
17 FPClass \
18 SpecialFloats \
19 TestBoolCmp \
20 error \
21 except \
22 overflow \
23 test_denormal_numbers \
24 test_divide_err \
25 test_empty \
26 test_exotic \
27 test_features \
28 test_half_fpe \
29 test_linear_interpolation_formula_symmetric \
30 test_log2_special \
31 test_nonarray_assignment \
32 test_special_values \
33 test_where \
34 test_zero_power_nonzero
35 endif
36 # The huge vector exceeds the available address space on 32 bit architectures
37 ifeq ($(DEB_HOST_ARCH_BITS),32)
38 SKIP_TESTS += \
39 test_huge_vectordot
40 endif
41 ifneq ($(filter armel,$(DEB_HOST_ARCH)),)
42 SKIP_TESTS += \
43 test_dot_errstate
44 endif
45 ifneq ($(filter mips64el,$(DEB_HOST_ARCH)),)
46 SKIP_TESTS += \
47 NanFunctions \
48 SpecialComplex \
49 SpecialFloats \
50 error \
51 test_reduce
52 endif
53 ifneq ($(filter alpha mips64el powerpc ppc64 sparc64,$(DEB_HOST_ARCH)),)
54 SKIP_TESTS += \
55 sq_cases
56 endif
57 ifneq ($(filter hppa powerpc,$(DEB_HOST_ARCH)),)
58 SKIP_TESTS += \
59 ctypeslib \
60 test_dtype
61 endif
62 ifneq ($(filter powerpc,$(DEB_HOST_ARCH)),)
63 SKIP_TESTS += \
64 test_linalg
65 endif
66 ifneq ($(filter ppc64el,$(DEB_HOST_ARCH)),)
67 SKIP_TESTS += \
68 test_cpu_features \
69 test_ppc64_ibm_double_double128 \
70 test_linear_interpolation_formula_symmetric
71 endif
72 ifneq ($(filter riscv64,$(DEB_HOST_ARCH)),)
73 SKIP_TESTS += \
74 test_unary_spurious_fpexception
75 endif
76 ifneq ($(filter s390x,$(DEB_HOST_ARCH)),)
77 SKIP_TESTS += \
78 test_cpu_features
79 endif
80 ifneq ($(filter hurd,$(DEB_HOST_ARCH_OS)),)
81 SKIP_TESTS += \
82 test_tuple_recursion
83 endif
84 ifneq ($(filter x32,$(DEB_HOST_ARCH)),)
85 SKIP_TESTS += \
86 test_advance_symmetry
87 endif
88 ifeq ($(PYBUILD_AUTOPKGTEST),1)
89 SKIP_TESTS += test_dict_mode
90 endif
91
92 export PYBUILD_TEST_ARGS = $(if $(SKIP_TESTS),-k 'not ($(call concat_with,$(space)or$(space),$(SKIP_TESTS)))')
93 ifeq ($(PYBUILD_AUTOPKGTEST),1)
94 PYBUILD_TEST_ARGS += /usr/lib/python3/dist-packages/numpy
95 endif
96
97 ifneq ($(DEB_HOST_ARCH),$(DEB_BUILD_ARCH))
98 export PYBUILD_BEFORE_BUILD = meson env2mfile --debarch $(DEB_HOST_ARCH) --cross -o {dir}/debian/meson-cross.txt \
99 && python3 {dir}/debian/helpers/add_longdouble_format_property.py {dir}/debian/meson-cross.txt $(DEB_HOST_ARCH)
100 export PYBUILD_AFTER_BUILD = rm {dir}/debian/meson-cross.txt
101 export PYBUILD_BUILD_ARGS = --config-setting setup-args=--cross-file={dir}/debian/meson-cross.txt
102 endif
103
104 # Helper variables
105 PY3VERS = $(shell py3versions -vr)
106 PY3DEF = $(shell py3versions -vd)
107 STAGING_DIR = $(CURDIR)/debian/tmp
108 PYTHON3_NUMPY_DIR = $(CURDIR)/debian/python3-numpy
109 space = $(eval) $(eval)
110 concat_with = $(subst $(space),$1,$2)
111
112 %:
113 dh $@ --buildsystem=pybuild
114
115 auto-build-for-default-python:
116 PYBUILD_DISABLE="$(filter-out $(PY3DEF),$(PY3VERS))" dh_auto_build
117 touch $@
118
119 auto-build-for-other-python:
120 PYBUILD_DISABLE="$(PY3DEF)" dh_auto_build
121 touch $@
122
123 override_dh_auto_build-arch: auto-build-for-default-python auto-build-for-other-python
124 true
125
126 override_dh_auto_build-indep: auto-build-for-default-python
127 $(MAKE) -C doc html \
128 GITVER=Unknown \
129 MPLCONFIGDIR=. \
130 SPHINXOPTS= \
131 PYTHON=python3 \
132 PYTHONPATH=$(shell pybuild --print {build_dir} --interpreter python3)
133
134 # Nothing to install for -indep
135 override_dh_auto_install-indep:
136
137 # No tests to run for the -doc package
138 override_dh_auto_test-indep:
139
140 override_dh_auto_test-arch:
141 dh_auto_test --arch -O--buildsystem=pybuild
142
143 execute_after_dh_python3-arch:
144 # tweak the entry_points console_scripts list to include all supported versions
145 if [ -f $(PYTHON3_NUMPY_DIR)/usr/lib/python3/dist-packages/numpy-*.dist-info/entry_points.txt ] ; then \
146 ENTRYPOINT=$(shell ls $(PYTHON3_NUMPY_DIR)/usr/lib/python3/dist-packages/numpy-*.dist-info/entry_points.txt) ; \
147 python3 debian/helpers/edit_console_scripts.py $$ENTRYPOINT "f2py3" "numpy.f2py.f2py2e:main" ; \
148 for v in $(PY3VERS); do \
149 python3 debian/helpers/edit_console_scripts.py $$ENTRYPOINT "f2py$$v" "numpy.f2py.f2py2e:main" ; \
150 done \
151 fi
152 # Remove test artifact
153 rm -f $(PYTHON3_NUMPY_DIR)/usr/lib/python3/dist-packages/xm.np.npy
154
155 MULTIARCH_TREE_DIR = $(STAGING_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/python3-numpy/numpy
156 execute_before_dh_install-arch:
157 # add versioned f2pyX.Y scripts
158 cp -a $(STAGING_DIR)/usr/bin/f2py $(STAGING_DIR)/usr/bin/f2py3
159 # Create wrappers to run python$$i without dh-python generating a
160 # hard dependency on all of those interpreters (#945824)
161 set -e; for v in $(PY3VERS); do \
162 sed -e "s,@VERSION@,$$v,g" debian/f2py.in > $(STAGING_DIR)/usr/bin/f2py$$v; \
163 chmod 0755 $(STAGING_DIR)/usr/bin/f2py$$v; \
164 done
165 # Remove various LICENSE files from inconvienient locations
166 find $(STAGING_DIR)/usr/lib -name "LICENSE*" -delete
167 # Move NumPy headers to Multi-Arch friendly location
168 mkdir -p $(MULTIARCH_TREE_DIR)/_core $(MULTIARCH_TREE_DIR)/random $(MULTIARCH_TREE_DIR)/f2py
169 mv $(STAGING_DIR)/usr/lib/python$(PY3DEF)/dist-packages/numpy/_core/include $(MULTIARCH_TREE_DIR)/_core
170 mv $(STAGING_DIR)/usr/lib/python$(PY3DEF)/dist-packages/numpy/_core/lib $(MULTIARCH_TREE_DIR)/_core
171 mv $(STAGING_DIR)/usr/lib/python$(PY3DEF)/dist-packages/numpy/random/lib $(MULTIARCH_TREE_DIR)/random
172 mv $(STAGING_DIR)/usr/lib/python$(PY3DEF)/dist-packages/numpy/f2py/src $(MULTIARCH_TREE_DIR)/f2py
173 rm -rf $(STAGING_DIR)/usr/lib/python3.*/dist-packages/numpy/_core/include
174 rm -rf $(STAGING_DIR)/usr/lib/python3.*/dist-packages/numpy/_core/lib
175 rm -rf $(STAGING_DIR)/usr/lib/python3.*/dist-packages/numpy/random/lib
176 rm -rf $(STAGING_DIR)/usr/lib/python3.*/dist-packages/numpy/f2py/src
177 # Remove build path from __config__.py
178 sed -i -e "s;$(CURDIR);\$$BUILDDIR;g" $(STAGING_DIR)/usr/lib/python3*/dist-packages/numpy/__config__.py
179 # Remove Python version information from __config__.py
180 sed -i -e '/"Python Information": {/,/},/d' $(STAGING_DIR)/usr/lib/python3*/dist-packages/numpy/__config__.py
181 # Install numpy.pc for global discovery (without numpy-config shenanigans)
182 mkdir -p $(STAGING_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig
183 sed \
184 -e "s,@VERSION@,$(shell echo $(DEB_VERSION_UPSTREAM) | cut -d+ -f1),g" \
185 -e "s,@MULTIARCH@,$(DEB_HOST_MULTIARCH),g" \
186 debian/numpy.pc.in > $(STAGING_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/numpy.pc
187
188 execute_before_dh_gencontrol:
189 python3 debian/helpers/numpy_substvars.py >> debian/python3-numpy.substvars
190
191 download_remote_intersphinx_inventories:
192 curl https://matplotlib.org/stable/objects.inv -o debian/intersphinx/matplotlib_objects.inv
193 curl https://numpydoc.readthedocs.io/en/latest/objects.inv -o debian/intersphinx/numpydoc_objects.inv
194 curl https://numpy.org/neps/objects.inv -o debian/intersphinx/neps_objects.inv
195 curl https://numpy.org/numpy-tutorials/objects.inv -o debian/intersphinx/numpy-tutorials_objects.inv
196 curl https://dmlc.github.io/dlpack/latest/objects.inv -o debian/intersphinx/dlpack_objects.inv
197 curl https://scipy-lectures.org/objects.inv -o debian/intersphinx/scipy-lectures_objects.inv