#!/usr/bin/make -f # -*- mode: makefile; coding: utf-8 -*- export DH_VERBOSE=1 include /usr/share/dpkg/default.mk PYVER = $(shell py3versions -vd) export PYBUILD_NAME = nipy # To fix distutils fragile nature: when seing LDFLAGS=, which is set # by dpkg-buildpackage it stops providing -shared flag, so for the # minimalistic fix (alternative to NMU-ed #535699 with explicit # -shared) we just unexport LDFLAGS unexport LDFLAGS export NIPY_EXTERNAL_LAPACK=1 # stop matplotlib from thinking it should display plots export MPLBACKEND=Agg # Mega rule %: dh $@ --buildsystem=pybuild --with=python3,sphinxdoc override_dh_auto_test: ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) : # Do not test just after build, lets install and then test endif manpages: @echo "I: generating manpages" set -e; mkdir -p $(CURDIR)/build/manpages && \ cd $(CURDIR)/debian/python3-nipy/usr/bin/ && for f in *; do \ descr=$$(grep -h -e "^ *'''" -e 'DESCRIP =' $$f | sed -e "s,.*' *\([^'][^']*\)'.*,\1,g" | head -n 1); \ PYTHONPATH=../ \ help2man -n "$$descr" --no-discard-stderr --no-info --version-string "$(DEB_VERSION_UPSTREAM)" "python3 ./$$f" \ >| ../../../../build/manpages/$$f.1; \ done execute_before_dh_auto_build: # FIXME: this probably ought to be forwarded upstream: @echo 'W: Frightening monkey patch following numpy 1.24, see #1027255.' find -type f -name '*.py' -or -name '*.pyx' -or -name '*.c' \ | xargs sed -i \ 's/\/\1/g' @echo 'I: Force regeneration of C code resulting from .pyx files' find $(CURDIR)/nipy/ -name '*.pyx' -exec cython3 '{}' ';' override_dh_auto_build-indep: : # I: build the arch-dep packages to be able to build the docs dh_auto_build : # I: Generate documentation PYTHONPATH=`pybuild --print build_dir --interpreter python$(PYVER)` \ http_proxy='127.0.0.1:9' \ PATH=$(CURDIR)/debian/tmp/usr/bin/:$$PATH \ HOME=$(CURDIR)/build \ $(MAKE) -C doc html PYTHON=python$(PYVER) : # I: Link in the local coy of mathjax ln -sf /usr/share/javascript/mathjax/ doc/build/html/_static/mathjax test: ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) : # I: Unittest only the default python version for now against "installed" materials # Make sure data files for test will be available cp -a $(PYBUILD_NAME)/testing/*.gz $(shell pybuild --print build_dir --interpreter python$(PYVER))/$(PYBUILD_NAME)/testing cp -a $(PYBUILD_NAME)/algorithms/statistics/models/tests/*.bin $(shell pybuild --print build_dir --interpreter python$(PYVER))/$(PYBUILD_NAME)/algorithms/statistics/models/tests cp -a $(PYBUILD_NAME)/labs/spatial_models/tests/*.nii $(shell pybuild --print build_dir --interpreter python$(PYVER))/$(PYBUILD_NAME)/labs/spatial_models/tests cp -a $(PYBUILD_NAME)/modalities/fmri/tests/* $(shell pybuild --print build_dir --interpreter python$(PYVER))/$(PYBUILD_NAME)/modalities/fmri/tests cp -a $(PYBUILD_NAME)/algorithms/diagnostics/tests/data $(shell pybuild --print build_dir --interpreter python$(PYVER))/$(PYBUILD_NAME)/algorithms/diagnostics/tests cd debian; \ NIPY_DEBUG_PRINT=1 PATH=$(CURDIR)/debian/python3-nipy/usr/bin:$$PATH \ PYTHONPATH=$(shell pybuild --print build_dir --interpreter python$(PYVER)):$$PYTHONPATH \ MPLCONFIGDIR=$(CURDIR)/build \ ../tools/nipnost nipy --exclude-test=nipy.tests.test_scripts.test_nipy_4d_realign --exclude-test=nipy.tests.test_scripts.test_nipy_3_4d --exclude-test=nipy.tests.test_scripts.test_nipy_tsdiffana --exclude-test=nipy.tests.test_scripts.test_nipy_diagnose else : # Skip unittests due to nocheck endif override_dh_install: test : # I: Move libraries into the python3-nipy-lib packages ( cd debian/python3-nipy/ && \ find . -iname *.so | \ while read so; do \ d=../python3-nipy-lib/$$(dirname $$so); \ mkdir -p $$d; echo "Moving $$so under $$d"; mv $$so $$d; \ done; \ ) dh_install : # I: Assure versioned dependency on NumPy dh_numpy3 -rm debian/python-nipy-doc/usr/share/javascript/underscore/underscore.js override_dh_python3: dh_python3 --shebang=/usr/bin/python3 ## immediately usable documentation and exemplar scripts/data override_dh_compress: : # I: Avoiding compression of what should not be compressed dh_compress -X.py -X.html -X.pdf -X.css -X.jpg -X.txt -X.js -X.json -X.rtc -Xobjects.inv override_dh_installman: manpages # FIXME: in their current state, manpages are useless, so are disabled. #dh_installman -ppython3-nipy build/manpages/*.1 override_dh_clean: : # I: Custom cleaning rm -rf build nipy/neurospin/__config__.py $(MAKE) -C doc clean dh_clean override_dh_auto_clean: # Do not force maintainers to install Build-Depends on local machine dh_auto_clean || rm -rf __pycache__ .pybuild