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 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
|
#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE = 1
include /usr/share/dpkg/architecture.mk
include /usr/share/dpkg/buildflags.mk
include /usr/share/dpkg/buildtools.mk
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_CFLAGS_MAINT_APPEND = $(shell pkgconf --cflags liblzf)
PYBUILD_NAME_SERIAL=h5py_serial
PYBUILD_NAME_MPI=h5py_mpi
BUILD_DIR_SERIAL=build-$(PYBUILD_NAME_SERIAL)
BUILD_DIR_MPI=build-$(PYBUILD_NAME_MPI)
SUBMODULE_SERIAL=_debian_$(PYBUILD_NAME_SERIAL)
SUBMODULE_MPI=_debian_$(PYBUILD_NAME_MPI)
PYBUILD_DIR_SERIAL=$(shell PYBUILD_NAME=$(PYBUILD_NAME_SERIAL) pybuild -p `py3versions -dv` --print {build_dir})
PYBUILD_DIR_MPI=$(shell PYBUILD_NAME=$(PYBUILD_NAME_MPI) pybuild -p `py3versions -dv` --print {build_dir})
PY3VER=$(shell py3versions -dv)
export PRTE_MCA_plm_ssh_agent=/bin/false
export PRTE_MCA_rmaps_default_mapping_policy=:oversubscribe
# ros3 tests require internet, which is not available from debian buildds
SKIP_TEST_LIST = ros3
ifneq (,$(findstring $(DEB_HOST_ARCH), powerpc))
SKIP_TEST_LIST += test_complex256 test_long_double test_custom_float_promotion
endif
ifneq (,$(findstring $(DEB_HOST_ARCH), sparc64))
SKIP_TEST_LIST += test_compound_vlen_bool test_compound_vlen_enum test_reference_numpyobj test_reference_field
endif
SKIP_TESTS=$(shell skip_tests=""; list_initialised=0; \
for t in $(SKIP_TEST_LIST); do \
if [ $${list_initialised} = 0 ]; then \
skip_tests=$$t; \
list_initialised=1; \
else \
skip_tests="$${skip_tests} or $$t"; \
fi; \
done; \
if [ "x$${skip_tests}" != "x" ]; then \
echo "not ( $${skip_tests} )"; \
fi )
%:
dh $@ --buildsystem=pybuild
execute_after_dh_clean:
rm -rf $(BUILD_DIR_SERIAL) $(BUILD_DIR_MPI)
rm -rf .pytest_cache
override_dh_auto_clean:
dh_auto_clean -D $(BUILD_DIR_SERIAL) || /bin/true
dh_auto_clean -D $(BUILD_DIR_MPI) || /bin/true
rm -Rf docs/_build docs_api/_build
override_dh_auto_configure:
mkdir $(BUILD_DIR_SERIAL); bash -O extglob -c "cp -ra ./!($(BUILD_DIR_SERIAL)) $(BUILD_DIR_SERIAL)"
sed "s/ \"h5py\./ \"h5py.$(SUBMODULE_SERIAL)./g; s/ \"h5py\",/ \"h5py.$(SUBMODULE_SERIAL)\",/g" -i $(BUILD_DIR_SERIAL)/pyproject.toml
sed "s/flavour=''/flavour='$(SUBMODULE_SERIAL)'/" -i $(BUILD_DIR_SERIAL)/setup_build.py
mv $(BUILD_DIR_SERIAL)/h5py $(BUILD_DIR_SERIAL)/$(SUBMODULE_SERIAL)
cp -r debian/wrapper_module/h5py $(BUILD_DIR_SERIAL)
mv $(BUILD_DIR_SERIAL)/$(SUBMODULE_SERIAL) $(BUILD_DIR_SERIAL)/h5py
mkdir $(BUILD_DIR_MPI); bash -O extglob -c "cp -ra ./!($(BUILD_DIR_SERIAL)|$(BUILD_DIR_MPI)) $(BUILD_DIR_MPI)"
sed "s/ \"h5py\./ \"h5py.$(SUBMODULE_MPI)./g; s/ \"h5py\",/ \"h5py.$(SUBMODULE_MPI)\",/g" -i $(BUILD_DIR_MPI)/pyproject.toml
sed "s/flavour=''/flavour='$(SUBMODULE_MPI)'/" -i $(BUILD_DIR_MPI)/setup_build.py
mv $(BUILD_DIR_MPI)/h5py $(BUILD_DIR_MPI)/$(SUBMODULE_MPI)
cp -r debian/wrapper_module/h5py $(BUILD_DIR_MPI)
mv $(BUILD_DIR_MPI)/$(SUBMODULE_MPI) $(BUILD_DIR_MPI)/h5py
# Note on versioned build-dependencies: upstream marks lower supported versioned-dependencies
# using equality (e.g. "mpi4py ==3.0.3"), meaning the lower supported version is forced in upstream pypi builds.
# We generally want to build using higher versions (the most recent available and packaged in unstable)
# Upstream suggests switching off version checking in that case, by setting H5PY_SETUP_REQUIRES=0.
# However rather than applying H5PY_SETUP_REQUIRES=0, in Debian we maintain minimal version checks
# by patching setup.py to inequalities where needed (e.g. "mpi4py >=3.0.3")
# build MPI build for both arch and indep builds (i.e. use MPI build to build docs in arch-indep build)
override_dh_auto_build: export http_proxy=127.0.0.1:9
override_dh_auto_build: export https_proxy=127.0.0.1:9
override_dh_auto_build:
PYBUILD_NAME=$(PYBUILD_NAME_MPI) CC=h5pcc HDF5_USE_SHLIB=yes HDF5_MPI=ON HDF5_PKGCONFIG_NAME=hdf5-mpi H5PY_SYSTEM_LZF=1 dh_auto_build -D $(BUILD_DIR_MPI)
for DIR in $$(find .pybuild/cpython3*mpi -name build); do \
cp -r $(CURDIR)/debian/wrapper_module/h5py/* $$DIR/h5py/; \
done
cd $(BUILD_DIR_MPI); \
$(CC) `find . -name lzf_filter.o | sort | head -n 1` $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(shell $(PKG_CONFIG) --cflags --libs hdf5-mpi liblzf) -fPIC -shared -o liblzf_filter.so
# build serial build only for arch builds
execute_after_dh_auto_build-arch: export http_proxy=127.0.0.1:9
execute_after_dh_auto_build-arch: export https_proxy=127.0.0.1:9
execute_after_dh_auto_build-arch:
PYBUILD_NAME=$(PYBUILD_NAME_SERIAL) HDF5_PKGCONFIG_NAME=hdf5-serial HDF5_USE_SHLIB=yes H5PY_SYSTEM_LZF=1 dh_auto_build -a -D $(BUILD_DIR_SERIAL)
for DIR in $$(find .pybuild/cpython3*serial -name build); do \
cp -r $(CURDIR)/debian/wrapper_module/h5py/* $$DIR/h5py/; \
done
cd $(BUILD_DIR_SERIAL); \
$(CC) `find . -name lzf_filter.o | sort | head -n 1` $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(shell $(PKG_CONFIG) --cflags --libs hdf5-serial liblzf) -fPIC -shared -o liblzf_filter.so
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
execute_after_dh_auto_build-indep: export http_proxy=127.0.0.1:9
execute_after_dh_auto_build-indep: export https_proxy=127.0.0.1:9
execute_after_dh_auto_build-indep:
PYTHONPATH=$(PYBUILD_DIR_MPI) mpirun -n 1 $(MAKE) -C docs html
PYTHONPATH=$(PYBUILD_DIR_MPI) mpirun -n 1 $(MAKE) -C docs_api html
endif
override_dh_auto_test-indep:
# should be running build-time tests with the --no-network option, not -m "not nonetwork"
# but it is not recognised inside h5py.run_tests()
# see https://github.com/h5py/h5py/issues/2286
override_dh_auto_test-arch:
ifneq (nocheck,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
if [ "x$(SKIP_TESTS)" != "x" ]; then echo "skipping tests: $(SKIP_TESTS)"; fi
set -e; \
for DIR in $$(find $(CURDIR)/.pybuild/cpython3*serial -name build); do \
echo "Running serial tests on $$DIR"; \
rm -rf $$DIR/h5py/_debian_h5py_serial/tests/data_files ; \
cp -r $(CURDIR)/h5py/tests/data_files $$DIR/h5py/_debian_h5py_serial/tests/; \
cd $$DIR/..; PYTHONPATH=$$DIR python$$(echo $$DIR | sed -e 's@.*cpython._\([[:digit:].]*\(_dbg\)*\).*_h5py.*@\1@g; s/_/-/') \
-c "from sys import exit; import h5py; exit(h5py.run_tests('-v -k \"$(SKIP_TESTS)\"'))"; \
rm -rf $$DIR/h5py/_debian_h5py_serial/tests/data_files ; \
cd ../..; done;
set -e; \
for DIR in $$(find $(CURDIR)/.pybuild/cpython3*mpi -name build); do \
echo "Running MPI tests on $$DIR"; \
rm -rf $$DIR/h5py/_debian_h5py_mpi/tests/data_files ; \
cp -r $(CURDIR)/h5py/tests/data_files $$DIR/h5py/_debian_h5py_mpi/tests/; \
cd $$DIR/..; pyver=$$(echo $$DIR | sed -e 's@.*cpython._\([[:digit:].]*\(_dbg\)*\).*_h5py.*@\1@g; s/_/-/'); \
PYTHONPATH=$$DIR python$$pyver -mpytest -v --with-mpi -p no:xvfb -k "$(SKIP_TESTS) and not TestMPI" $$DIR/h5py/_debian_h5py_mpi/tests; \
PYTHONPATH=$$DIR mpirun -n 2 python$$pyver -mpytest -v --with-mpi -p no:xvfb -k TestMPI $$DIR/h5py/_debian_h5py_mpi/tests/test_file.py; \
rm -rf $$DIR/h5py/_debian_h5py_mpi/tests/data_files ; \
cd ../..; done;
else
echo "Tests not run since nocheck was set in DEB_BUILD_OPTIONS"
endif
dh_auto_install_mpi: $(eval SHELL := /bin/bash)
PYBUILD_NAME=$(PYBUILD_NAME_MPI) CC=h5pcc HDF5_PKGCONFIG_NAME=hdf5-mpi HDF5_USE_SHLIB=yes HDF5_MPI=ON H5PY_SYSTEM_LZF=1 dh_auto_install -D $(BUILD_DIR_MPI)
override_dh_auto_install-arch: dh_auto_install_mpi $(eval SHELL := /bin/bash)
PYBUILD_NAME=$(PYBUILD_NAME_SERIAL) HDF5_PKGCONFIG_NAME=hdf5-serial HDF5_USE_SHLIB=yes H5PY_SYSTEM_LZF=1 dh_auto_install -D $(BUILD_DIR_SERIAL)
override_dh_auto_install-indep: dh_auto_install_mpi
mkdir -p debian/python3-h5py/usr/lib/python3/dist-packages/h5py
cp debian/wrapper_module/h5py/__init__.py debian/python3-h5py/usr/lib/python3/dist-packages/h5py
cp -r debian/python3-h5py-mpi/usr/lib/python$(PY3VER)/dist-packages/h5py-*.dist-info debian/python3-h5py/usr/lib/python3/dist-packages/
sed "/Requires-Dist: mpi4py/d" -i debian/python3-h5py/usr/lib/python3/dist-packages/h5py*.dist-info/METADATA
rm -f debian/python3-h5py/usr/lib/python3/dist-packages/h5py-*.dist-info/RECORD
rm -f debian/python3-h5py/usr/lib/python3/dist-packages/h5py-*.dist-info/LICENSE
rm -f debian/python3-h5py/usr/lib/python3/dist-packages/h5py-*.dist-info/WHEEL
execute_after_dh_auto_install-arch:
for d in debian/python3-h5py-serial/usr/lib/python3*/dist-packages/h5py-*.dist-info; do \
sed "s/^h5py-\(.*.dist-info\)/h5py.$(SUBMODULE_SERIAL)-\1/" -i $$d/RECORD; \
mv $$d `echo $$d | sed "s|-packages/h5py-|-packages/h5py.$(SUBMODULE_SERIAL)-|"`; \
done
for d in debian/python3-h5py-mpi/usr/lib/python3*/dist-packages/h5py-*.dist-info; do \
sed "s/^h5py-\(.*.dist-info\)/h5py.$(SUBMODULE_MPI)-\1/" -i $$d/RECORD; \
mv $$d `echo $$d | sed "s|-packages/h5py-|-packages/h5py.$(SUBMODULE_MPI)-|"`; \
done
sed "s/Name: h5py/Name: h5py.$(SUBMODULE_SERIAL:_=-)/" -i debian/python3-h5py-serial/usr/lib/python3*/dist-packages/h5py*.dist-info/METADATA
sed "s/h5py/h5py.$(SUBMODULE_SERIAL)/" -i debian/python3-h5py-serial/usr/lib/python3*/dist-packages/h5py*.dist-info/top_level.txt
sed "s/Name: h5py/Name: h5py.$(SUBMODULE_MPI:_=-)/" -i debian/python3-h5py-mpi/usr/lib/python3*/dist-packages/h5py*.dist-info/METADATA
sed "s/h5py/h5py.$(SUBMODULE_MPI)/" -i debian/python3-h5py-mpi/usr/lib/python3*/dist-packages/h5py*.dist-info/top_level.txt
override_dh_install-arch:
rm -rf debian/python3-h5py-serial/usr/lib/python*/dist-packages/h5py/_debian_h5py_serial/tests/data_files
rm -rf debian/python3-h5py-mpi/usr/lib/python*/dist-packages/h5py/_debian_h5py_mpi/tests/data_files
dh_install -a
dh_install -phdf5-plugin-lzf $(BUILD_DIR_SERIAL)/liblzf_filter.so $(shell $(PKG_CONFIG) --variable=PluginDir hdf5-serial)
dh_install -phdf5-plugin-lzf $(BUILD_DIR_MPI)/liblzf_filter.so $(shell $(PKG_CONFIG) --variable=PluginDir hdf5-mpi)
override_dh_python3-arch:
PYBUILD_NAME=$(PYBUILD_NAME_SERIAL) dh_python3
PYBUILD_NAME=$(PYBUILD_NAME_MPI) dh_python3
dh_numpy3
rm -f debian/python3-h5py-*/usr/lib/python3/dist-packages/h5py/__init__.py
|