File: rules

package info (click to toggle)
numpy 1%3A2.2.4%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 83,420 kB
  • sloc: python: 248,499; asm: 232,365; ansic: 216,874; cpp: 135,657; f90: 1,540; sh: 938; fortran: 558; makefile: 409; sed: 139; xml: 109; java: 92; perl: 79; cs: 54; javascript: 53; objc: 29; lex: 13; yacc: 9
file content (171 lines) | stat: -rwxr-xr-x 6,708 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
168
169
170
171
#!/usr/bin/make -f

include /usr/share/dpkg/architecture.mk
include /usr/share/dpkg/pkg-info.mk

# Large file support actually works, but some buildds and Salsa do not like us
# creating 5 GB files.
SKIP_TESTS = \
	test_big_arrays \
	test_large_file_support
# Some tests have architecture-specific issues. Generally, these are related to
# unexpected behavior of floating point operations (unexpected for the unit
# tests, that is).
ifneq ($(filter armel armhf,$(DEB_HOST_ARCH)),)
SKIP_TESTS += \
	FPClass \
	SpecialFloats \
	TestBoolCmp \
	error \
	except \
	overflow \
	test_denormal_numbers \
	test_divide_err \
	test_empty \
	test_exotic \
	test_features \
	test_half_fpe \
	test_linear_interpolation_formula_symmetric \
	test_log2_special \
	test_nonarray_assignment \
	test_special_values \
	test_where \
	test_zero_power_nonzero
endif
# The huge vector exceeds the available address space on 32 bit architectures
ifeq ($(DEB_HOST_ARCH_BITS),32)
SKIP_TESTS += \
	test_huge_vectordot
endif
ifneq ($(filter mips64el,$(DEB_HOST_ARCH)),)
SKIP_TESTS += \
	NanFunctions \
	SpecialComplex \
	SpecialFloats \
	error \
	test_reduce
endif
ifneq ($(filter alpha mips64el powerpc ppc64 sparc64,$(DEB_HOST_ARCH)),)
SKIP_TESTS += \
	sq_cases
endif
ifneq ($(filter hppa powerpc,$(DEB_HOST_ARCH)),)
SKIP_TESTS += \
	ctypeslib \
	test_dtype
endif
ifneq ($(filter powerpc,$(DEB_HOST_ARCH)),)
SKIP_TESTS += \
	test_linalg
endif
ifeq ($(PYBUILD_AUTOPKGTEST),1)
SKIP_TESTS += test_dict_mode
endif

export PYBUILD_BUILD_ARGS = --config-setting build-dir={dir}/.mesonpy
export PYBUILD_TEST_ARGS = $(if $(SKIP_TESTS),-k 'not ($(call concat_with,$(space)or$(space),$(SKIP_TESTS)))')
ifeq ($(PYBUILD_AUTOPKGTEST),1)
PYBUILD_TEST_ARGS += /usr/lib/python3/dist-packages/numpy
endif

ifneq ($(DEB_HOST_ARCH),$(DEB_BUILD_ARCH))
export PYBUILD_BEFORE_BUILD = meson env2mfile --debarch $(DEB_HOST_ARCH) --cross -o {dir}/debian/meson-cross.txt \
	&& python3 {dir}/debian/helpers/add_longdouble_format_property.py {dir}/debian/meson-cross.txt $(DEB_HOST_ARCH)
export PYBUILD_AFTER_BUILD = rm {dir}/debian/meson-cross.txt
PYBUILD_BUILD_ARGS += --config-setting setup-args=--cross-file={dir}/debian/meson-cross.txt
endif

# Helper variables
PY3VERS = $(shell py3versions -vr)
PY3DEF = $(shell py3versions -vd)
STAGING_DIR = $(CURDIR)/debian/tmp
PYTHON3_NUMPY_DIR = $(CURDIR)/debian/python3-numpy
space = $(eval) $(eval)
concat_with = $(subst $(space),$1,$2)

%:
	dh $@ --buildsystem=pybuild

auto-build-for-default-python:
	PYBUILD_DISABLE="$(filter-out $(PY3DEF),$(PY3VERS))" dh_auto_build
	touch $@

auto-build-for-other-python:
	PYBUILD_DISABLE="$(PY3DEF)" dh_auto_build
	touch $@

override_dh_auto_build-arch: auto-build-for-default-python auto-build-for-other-python
	true

override_dh_auto_build-indep: auto-build-for-default-python
	$(MAKE) -C doc html \
		GITVER=Unknown \
		MPLCONFIGDIR=. \
		SPHINXOPTS= \
		PYTHON=python3 \
		PYTHONPATH=$(shell pybuild --print {build_dir} --interpreter python3)

# Nothing to install for -indep
override_dh_auto_install-indep:

# No tests to run for the -doc package
override_dh_auto_test-indep:

override_dh_auto_test-arch:
	dh_auto_test --arch -O--buildsystem=pybuild

execute_after_dh_python3-arch:
	# tweak the entry_points console_scripts list to include all supported versions
	if [ -f $(PYTHON3_NUMPY_DIR)/usr/lib/python3/dist-packages/numpy-*.dist-info/entry_points.txt ] ; then \
		ENTRYPOINT=$(shell ls $(PYTHON3_NUMPY_DIR)/usr/lib/python3/dist-packages/numpy-*.dist-info/entry_points.txt) ; \
		python3 debian/helpers/edit_console_scripts.py $$ENTRYPOINT "f2py3" "numpy.f2py.f2py2e:main" ; \
		for v in $(PY3VERS); do \
			python3 debian/helpers/edit_console_scripts.py $$ENTRYPOINT "f2py$$v" "numpy.f2py.f2py2e:main" ; \
		done \
	fi
	# Remove test artifact
	rm -f $(PYTHON3_NUMPY_DIR)/usr/lib/python3/dist-packages/xm.np.npy

MULTIARCH_TREE_DIR = $(STAGING_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/python3-numpy/numpy
execute_before_dh_install-arch:
	# add versioned f2pyX.Y scripts
	cp -a $(STAGING_DIR)/usr/bin/f2py $(STAGING_DIR)/usr/bin/f2py3
	# Create wrappers to run python$$i without dh-python generating a
	# hard dependency on all of those interpreters (#945824)
	set -e; for v in $(PY3VERS); do \
		sed -e "s,@VERSION@,$$v,g" debian/f2py.in > $(STAGING_DIR)/usr/bin/f2py$$v; \
		chmod 0755 $(STAGING_DIR)/usr/bin/f2py$$v; \
	done
	# Remove various LICENSE files from inconvienient locations
	find $(STAGING_DIR)/usr/lib -name "LICENSE*" -delete
	# Move NumPy headers to Multi-Arch friendly location
	mkdir -p $(MULTIARCH_TREE_DIR)/_core $(MULTIARCH_TREE_DIR)/random $(MULTIARCH_TREE_DIR)/f2py
	mv $(STAGING_DIR)/usr/lib/python$(PY3DEF)/dist-packages/numpy/_core/include $(MULTIARCH_TREE_DIR)/_core
	mv $(STAGING_DIR)/usr/lib/python$(PY3DEF)/dist-packages/numpy/_core/lib $(MULTIARCH_TREE_DIR)/_core
	mv $(STAGING_DIR)/usr/lib/python$(PY3DEF)/dist-packages/numpy/random/lib $(MULTIARCH_TREE_DIR)/random
	mv $(STAGING_DIR)/usr/lib/python$(PY3DEF)/dist-packages/numpy/f2py/src $(MULTIARCH_TREE_DIR)/f2py
	rm -rf $(STAGING_DIR)/usr/lib/python3.*/dist-packages/numpy/_core/include
	rm -rf $(STAGING_DIR)/usr/lib/python3.*/dist-packages/numpy/_core/lib
	rm -rf $(STAGING_DIR)/usr/lib/python3.*/dist-packages/numpy/random/lib
	rm -rf $(STAGING_DIR)/usr/lib/python3.*/dist-packages/numpy/f2py/src
	# Remove build path from __config__.py
	sed -i -e "s;$(CURDIR);\$$BUILDDIR;g" $(STAGING_DIR)/usr/lib/python3*/dist-packages/numpy/__config__.py
	# Remove Python version information from __config__.py
	sed -i -e '/"Python Information": {/,/},/d' $(STAGING_DIR)/usr/lib/python3*/dist-packages/numpy/__config__.py
	# Install numpy.pc for global discovery (without numpy-config shenanigans)
	mkdir -p $(STAGING_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig
	sed \
		-e "s,@VERSION@,$(shell echo $(DEB_VERSION_UPSTREAM) | cut -d+ -f1),g" \
		-e "s,@MULTIARCH@,$(DEB_HOST_MULTIARCH),g" \
		debian/numpy.pc.in > $(STAGING_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/numpy.pc

execute_before_dh_gencontrol:
	python3 debian/helpers/numpy_substvars.py >> debian/python3-numpy.substvars

download_remote_intersphinx_inventories:
	curl https://matplotlib.org/stable/objects.inv -o debian/intersphinx/matplotlib_objects.inv
	curl https://numpydoc.readthedocs.io/en/latest/objects.inv -o debian/intersphinx/numpydoc_objects.inv
	curl https://numpy.org/neps/objects.inv -o debian/intersphinx/neps_objects.inv
	curl https://numpy.org/numpy-tutorials/objects.inv -o debian/intersphinx/numpy-tutorials_objects.inv
	curl https://dmlc.github.io/dlpack/latest/objects.inv -o debian/intersphinx/dlpack_objects.inv
	curl https://scipy-lectures.org/objects.inv -o debian/intersphinx/scipy-lectures_objects.inv