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
|
#!/usr/bin/make -f
# -*- makefile -*-
export PYBUILD_NAME=dipy
PACKAGE3_NAME = python3-$(PYBUILD_NAME)
PACKAGE3_ROOT_DIR = $(CURDIR)/debian/${PACKAGE3_NAME}
INSTALL_PATH = $(CURDIR)/debian/tmp
ifeq (,$(findstring get-orig-source, $(MAKECMDGOALS)))
export http_proxy=http://127.0.0.1:9/
endif
# default Python
PY3VERS = $(shell py3versions -vr)
PY3VER = $(shell py3versions -vd)
include /usr/share/dpkg/default.mk
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
MIN_CYTHONVER = 0.25.1
BUILD_DATE := "$(date --utc --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%B %d, %Y)"
SPHINXOPTS := -D today=\"$(BUILD_DATE)\"
ifneq (,$(findstring $(DEB_BUILD_ARCH),s390x))
REMOVE_FILES := dipy/align/tests/test_streamlinear.py dipy/align/tests/test_streamline.py dipy/tracking/tests/test_distances.py dipy/viz/tests/test_fury.py dipy/workflows/tests/test_align.py dipy/workflows/tests/test_segment.py dipy/align/tests/test_whole_brain_slr.py dipy/data/tests/test_data.py
endif
%:
dh $@ --buildsystem=pybuild --with python3
execute_before_dh_auto_configure:
rm -f $(REMOVE_FILES)
override_dh_auto_clean:
dh_auto_clean || true
rm -rf .pybuild __pycache__
override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
: # Do not test just after build, lets install and then test
endif
override_dh_auto_build:
chmod 0644 doc/examples/*.py
dh_auto_build
echo "backend : Agg" >| build/matplotlibrc
find -name func_coef.nii.gz -print -exec chmod 0644 '{}' ';'
override_dh_auto_install:
dh_auto_install
: # Prune duplicate LICENSE file
find debian/ -name LICENSE -delete
: # Only now lets build docs
ifeq (python-dipy-doc_,$(filter python-dipy-doc,$(shell dh_listpackages))_$(filter nodoc,$(DEB_BUILD_OPTIONS)))
export PYTHONPATH=$(shell pybuild --print build_dir --interpreter python3) \
MPLCONFIGDIR=$(CURDIR)/build HOME=$(CURDIR)/build; \
cd doc; $(MAKE) html-after-examples SPHINXOPTS="$(SPHINXOPTS)"
-rm doc/_build/html/_static/jquery.js
-rm -r doc/_build/html/_sources
: # objects inventory is of no use for the package
-rm doc/_build/html/objects.inv
# references to cloudflare and github are privacy breaches
sed 's@https://cdnjs\.cloudflare\.com/ajax/libs/mathjax/[^/]\+/@file:///usr/share/javascript/mathjax/unpacked/@' \
-i doc/_build/html/*.html \
doc/_build/html/interfaces/*.html \
doc/_build/html/theory/*.html
# FIXME: references to github are for images part of dipy_data, which
# is not available in debian; these may need packaging to solve the
# privacy breach here.
endif
# Run tests later on
# cd build to prevent use of local/not-built source tree
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
set -ex \
; export http_proxy=http://127.0.0.1:9/ \
; export https_proxy=https://127.0.0.1:9/ \
; for PYTHON in $(PY3VERS) \
; do PYPKG="$(PACKAGE3_ROOT_DIR)/usr/lib/python$$PYTHON/dist-packages" \
; export PYTHONPATH="$$PYPKG" \
; echo "I: Running Dipy unittests using $$PYTHON" \
; cd "$$PYPKG" \
; PATH=$(PACKAGE3_ROOT_DIR)/usr/bin:$$PATH \
HOME=/tmp \
MPLCONFIGDIR=/tmp/ xvfb-run -a -s "-screen 0 1280x1024x24 -noreset" \
python$$PYTHON -m pytest dipy \
; rm .pytest_cache -rf \
; done
endif
find debian/$(PACKAGE3_NAME)/usr/lib/python3* \( -name affine.txt -o -name "*.trk" \) -delete
## "Instantiate" both rules so dh sees them
override_dh_python3:
set -e \
; test -d debian/$(PACKAGE3_NAME)/usr/lib || exit 0 \
; for lib in $$(find debian/$(PACKAGE3_NAME)/usr/lib -name "*.so") \
; do sdir=$$(dirname $$lib) \
; tdir=debian/$(PACKAGE3_NAME)-lib/$${sdir#*$(PACKAGE3_NAME)/} \
; mkdir -p "$${tdir}" \
; mv -v "$${lib}" "$${tdir}" \
; done
dh_numpy3 -p$(PACKAGE3_NAME)-lib
dh_python3
## immediately useable documentation
## and exemplar data (they are small excerpts anyway)
override_dh_compress:
dh_compress -X.py -X.html -X.css -X.jpg -X.txt -X.js -X.json -X.rtc -X.par -X.bin -Xobjects.inv
override_dh_clean:
: # I: Custom cleaning
rm -rf build doc-stamp
$(MAKE) -C doc clean
dh_clean
override_dh_dwz:
dh_dwz || true
inject-doc-examples:
mkdir -p doc-examples
tar -C doc-examples --strip-components 1 \
-xzvf ../tarballs/$(DEB_SOURCE)_$(DEB_VERSION_UPSTREAM).orig-doc-examples.tar.gz
|