Debian Codegraph @

debian/rules

raw
1 #!/usr/bin/make -f
2 # -*- makefile -*-
3
4 DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
5
6 # define ARCH_DEFAULT_MPI_IMPL
7 include /usr/share/mpi-default-dev/debian_defaults
8
9 PY3DEF = $(shell py3versions -vd)
10 PY3VERS = $(shell py3versions -vs)
11
12 LAST_CHANGE = $(shell dpkg-parsechangelog -S Date)
13 BUILD_DATE = $(shell LC_ALL=C date -u "+%B %d, %Y" -d "$(LAST_CHANGE)")
14
15 # enable enhanced support for the MPI 5.0 standard ABI and the MPICH or Open MPI legacy ABIs
16 export MPI4PY_BUILD_MPIABI=1
17
18 export PRTE_MCA_rmaps_default_mapping_policy=:oversubscribe
19
20 # avoid network-related (OPAL/libucs) errors, see Bug#1100120
21 export OMPI_MCA_btl_tcp_if_include=lo
22
23 ifeq ($(DEB_HOST_ARCH),sh4)
24 export DEB_CFLAGS_MAINT_APPEND = -mno-lra
25 endif
26
27 # Specify a specific version of MPI to use in the build, otherwise
28 # just use the default.
29 # MPI=.openmpi
30
31 export http_proxy=http://127.0.0.1:9/
32 export https_proxy=http://127.0.0.1:9/
33
34
35 # disable build tests for these arches:
36 # x32 consistently times out on tests
37 NO_TEST_ARCH_LIST = x32
38
39 empty :=
40 space := $(empty)$(empty)
41
42 # run tests, or not
43 RUNTEST=yes
44 ifneq (,$(findstring $(space)$(DEB_HOST_ARCH)$(space), $(space)$(NO_TEST_ARCH_LIST)$(space)))
45 RUNTEST=no
46 endif
47 ifneq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
48 RUNTEST=no
49 endif
50
51 ifeq ($(DEB_HOST_ARCH),mips64el)
52 # mips64el times out. Run tests on default python only.
53 PY3VERS_TESTS = $(PY3DEF)
54 else
55 PY3VERS_TESTS = $(PY3VERS)
56 endif
57
58 # hurd fails a couple of tests
59 # but hell, hurd needs all the help it can get, so let it pass
60 ARCH_IGNORE_FAILED_TESTS = hurd-i386
61
62 # normally, do not ignore test failures
63 IGNORE_FAILED_TESTS=/bin/false
64 ifneq (,$(findstring $(space)$(DEB_HOST_ARCH)$(space), $(space)$(ARCH_IGNORE_FAILED_TESTS)$(space)))
65 IGNORE_FAILED_TESTS=/bin/true
66 endif
67
68 # OpenMPI is triggering both PMIX and spawn errors
69 CHECK_OPENMPI = $(MPI) $(ARCH_DEFAULT_MPI_IMPL)
70 ifneq (,$(findstring $(space)openmpi$(space), $(space)$(CHECK_OPENMPI)$(space)))
71 # OpenMPI is triggering spawn errors
72 # see Bug#1100120
73 SKIP_TEST_LIST += test_spawn
74 endif
75
76 # failing RMA tests from test_rma_nb
77 SKIP_RMA_ACCUMULATE_ARCH_LIST = s390x ppc64 sparc64
78 ifneq (,$(findstring $(space)$(DEB_HOST_ARCH)$(space), $(space)$(SKIP_RMA_ACCUMULATE_ARCH_LIST)$(space)))
79 SKIP_TEST_LIST += testAccumulate testGetAccumulate
80 endif
81
82 ifeq ($(DEB_HOST_ARCH),mips64el)
83 SKIP_TEST_LIST += TestRMA
84 endif
85
86 ifeq ($(DEB_HOST_ARCH),sparc64)
87 # OpenMPI broke memory alignment on sparc64, see https://github.com/mpi4py/mpi4py/issues/147
88 SKIP_TEST_LIST += testPackUnpackExternal
89 endif
90
91 # testContiguousBigMPI fails on 32-bit systems
92 # https://github.com/mpi4py/mpi4py/issues/670
93 ifeq ($(DEB_HOST_ARCH_BITS),32)
94 SKIP_TEST_LIST += testContiguousBigMPI
95 endif
96
97 %:
98 dh $@ --buildsystem pybuild
99
100 cythonize:
101 @echo "D: removing previously generated by Cython sources"
102 find -iname *.c | xargs grep -l 'Generated by Cython' | xargs -r rm
103 python3 setup.py build_src
104
105 override_dh_autoreconf:
106 dh_autoreconf debian/rules -- cythonize
107
108 execute_before_dh_auto_install-indep:
109 PYTHONPATH=`pybuild -p $(PY3DEF) --print "{build_dir}"` \
110 make -C docs/source/ html man info latexpdf SPHINXOPTS="-D today=\"$(BUILD_DATE)\""
111
112 execute_after_dh_auto_install:
113 : # Remove python-mpi binaries
114 find $(CURDIR)/debian/tmp -name python-mpi -delete
115 find $(CURDIR)/debian/tmp -type d -empty -delete
116
117 execute_after_dh_install-arch:
118 : # create symlinks for .h files
119 : # Can have python$$v symlink pointing to python3.?m or python3.?mu
120 : # see #700995 for more details. So first look where it points to
121 : # and use that directory
122 set -e; for v in $(PY3VERS); do \
123 ABITAG=`python$$v -c "import sys; print(sys.abiflags)"`; \
124 [ -d $(CURDIR)/debian/python3-mpi4py/usr/include/python$$v$$ABITAG ] || \
125 mkdir -p $(CURDIR)/debian/python3-mpi4py/usr/include/python$$v$$ABITAG; \
126 dh_link -ppython3-mpi4py usr/lib/python3/dist-packages/mpi4py/include/mpi4py usr/include/python$$v$$ABITAG/mpi4py; \
127 done
128
129 override_dh_auto_test:
130 set -e; \
131 if [ "$(RUNTEST)" = "no" ]; then \
132 echo Build tests have been disabled; \
133 else \
134 SKIP_TESTS=""; \
135 list_initialised=0; \
136 for t in $(SKIP_TEST_LIST); do \
137 if [ $${list_initialised} = 0 ]; then \
138 SKIP_TESTS="-x $$t"; \
139 list_initialised=1; \
140 else \
141 SKIP_TESTS="$${SKIP_TESTS} -x $$t"; \
142 fi; \
143 done; \
144 echo "skipping tests: $${SKIP_TESTS}"; \
145 for vv in $(PY3VERS_TESTS); do \
146 echo "I: testing using python$$vv"; \
147 echo "I: running tests with single process"; \
148 PYTHONPATH=`pybuild -p $$vv --print "{build_dir}"` \
149 GITHUB_ACTIONS=true MPI4PY_TEST_SPAWN=false \
150 /usr/bin/python$$vv $(CURDIR)/test/runtests.py -v $${SKIP_TESTS} || $(IGNORE_FAILED_TESTS); \
151 nproc=`nproc`; MIN_PROC=$$(( nproc > 2 ? nproc : 2 )); \
152 NUM_PROC=$$(( MIN_PROC > 5 ? 5 : MIN_PROC )); \
153 echo "I: running tests with MPI ($$NUM_PROC processes)"; \
154 PYTHONPATH=`pybuild -p $$vv --print "{build_dir}"` \
155 GITHUB_ACTIONS=true MPI4PY_TEST_SPAWN=false \
156 mpirun -v -n $$NUM_PROC /usr/bin/python$$vv $(CURDIR)/test/runtests.py -fv $${SKIP_TESTS} || $(IGNORE_FAILED_TESTS); \
157 done; \
158 fi
159
160 override_dh_sphinxdoc:
161 ifeq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS)))
162 dh_sphinxdoc -ppython-mpi4py-doc
163 endif
164
165 override_dh_installchangelogs:
166 dh_installchangelogs CHANGES.rst
167
168 ## Immediately useable documentation
169 override_dh_compress:
170 dh_compress -X.py -X.html -X.css -X.jpg -X.txt -X.js -X.json -X.rtc -X.par -X.bin -Xobjects.inv -X.pdf
171
172 override_dh_dwz:
173 echo "dh_dwz is currently deactivated since it generates an error: \".debug_line reference above end of section\""
174
175 execute_after_dh_auto_clean:
176 rm -rf `find -name build -type d`
177 rm -rf `find -name _build -type d`
178 rm -rf docs/source/reference
179
180 : # Remove Cython generated files
181 rm -f src/mpi4py.MPE.c src/mpi4py.MPI.c src/include/mpi4py/mpi4py.MPI_api.h