| 1 |
#!/usr/bin/make -f |
| 2 |
# -*- mode: makefile; coding: utf-8 -*- |
| 3 |
|
| 4 |
BINDIR=$(CURDIR)/debian/tmp/usr/bin/ |
| 5 |
NIBABEL_MODULE_DIR=$(CURDIR)/debian/*/usr/lib/python*/dist-packages/nibabel |
| 6 |
|
| 7 |
# Setting MPLCONFIGDIR to please matplotlib demanding writable HOME |
| 8 |
# on older systems (e.g. 12.04) |
| 9 |
export MPLCONFIGDIR=$(CURDIR)/build |
| 10 |
|
| 11 |
%: |
| 12 |
dh $@ --buildsystem=pybuild --builddirectory=build |
| 13 |
|
| 14 |
execute_after_dh_auto_build: |
| 15 |
PYTHONPATH=$(CURDIR) \ |
| 16 |
$(MAKE) -C doc html \ |
| 17 |
SPHINXBUILD=/usr/share/sphinx/scripts/python3/sphinx-build \ |
| 18 |
PYTHON=python3 |
| 19 |
# but remove jquery copy (later on link to Debian's version) |
| 20 |
-rm build/html/_static/jquery.js |
| 21 |
# objects inventory is of no use for the package |
| 22 |
-rm build/html/objects.inv |
| 23 |
# also doc source files only consume space |
| 24 |
-rm -r build/html/_sources |
| 25 |
|
| 26 |
# enable when we believe that the tests should pass |
| 27 |
override_dh_auto_test: |
| 28 |
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) |
| 29 |
PYBUILD_SYSTEM=custom \ |
| 30 |
PYBUILD_TEST_ARGS="PATH={dir}/.pybuild/cpython3_{version}/scripts:$(PATH) PYTHONPATH={build_dir} LC_ALL=C.UTF-8 {interpreter} -m pytest --verbose" \ |
| 31 |
dh_auto_test |
| 32 |
endif |
| 33 |
|
| 34 |
execute_after_dh_auto_install: |
| 35 |
find $(NIBABEL_MODULE_DIR) -type f -name .gitignore -delete |
| 36 |
|
| 37 |
## immediately useable documentation |
| 38 |
## and exemplar data (they are small excerpts anyway) |
| 39 |
COMPRESS_EXCLUDE_EXTS := .py .html .css .jpg .txt .js .json .rtc .par .bin |
| 40 |
override_dh_compress: |
| 41 |
dh_compress $(foreach EXT,$(COMPRESS_EXCLUDE_EXTS),-X$(EXT)) |
| 42 |
|
| 43 |
override_dh_installman: |
| 44 |
PYTHONPATH=build/lib:$(PYTHONPATH) \ |
| 45 |
help2man -N $(BINDIR)/parrec2nii \ |
| 46 |
-n 'convert PARREC image to NIfTI' \ |
| 47 |
> build/parrec2nii.1 |
| 48 |
PYTHONPATH=build/lib:$(PYTHONPATH) \ |
| 49 |
help2man -N $(BINDIR)/nib-dicomfs \ |
| 50 |
-n 'FUSE filesystem on top of a directory with DICOMs' \ |
| 51 |
> build/nib-dicomfs.1 |
| 52 |
PYTHONPATH=build/lib:$(PYTHONPATH) \ |
| 53 |
help2man -N $(BINDIR)/nib-ls \ |
| 54 |
-n "'ls' for neuroimaging files" \ |
| 55 |
> build/nib-ls.1 |
| 56 |
PYTHONPATH=build/lib:$(PYTHONPATH) \ |
| 57 |
help2man -N $(BINDIR)/nib-nifti-dx \ |
| 58 |
-n "header diagnostic tool" \ |
| 59 |
> build/nib-nifti-dx.1 |
| 60 |
dh_installman build/*.1 |
| 61 |
|
| 62 |
execute_before_dh_fixperms: |
| 63 |
chmod -x $(NIBABEL_MODULE_DIR)/gifti/tests/data/gzipbase64.gii |
| 64 |
chmod -x $(NIBABEL_MODULE_DIR)/tests/data/umass_anonymized.PAR |
| 65 |
chmod -x $(NIBABEL_MODULE_DIR)/nicom/dicomwrappers.py |
| 66 |
chmod -x $(NIBABEL_MODULE_DIR)/nicom/tests/test_dicomwrappers.py |
| 67 |
|
| 68 |
execute_before_dh_clean: |
| 69 |
$(MAKE) clean |