#!/usr/bin/make -f # -*- makefile -*- ifeq (,$(findstring get-orig-source, $(MAKECMDGOALS))) export http_proxy=http://127.0.0.1:9/ endif include /usr/share/dpkg/default.mk BUILD_DATE=$(shell TZ=UTC LC_ALL=C date --date="@$(SOURCE_DATE_EPOCH)" +'%b %d %Y') SPHINXOPTS = -D html_last_updated_fmt="$(BUILD_DATE)" PACKAGE_NAME = python3-brian PACKAGE_ROOT_DIR = debian/${PACKAGE_NAME} INSTALL_PATH = $(CURDIR)/debian/tmp # default Python PYTHON=$(shell py3versions -d) PYTHON_VERSION=$(shell py3versions -d -v) # override HOME (setfor weave) and matplotlib config directory # to allow building in chroots with read-only HOME export HOME=$(CURDIR)/build export MPLCONFIGDIR=$(HOME) # Brian allows to install without extensions. We want to assure that # they are there export BRIAN_SETUP_FAIL_ON_ERROR=1 export DEB_BUILD_MAINT_OPTIONS=hardening=+all %: dh $@ --with python3 --buildsystem=pybuild override_dh_auto_test: ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) echo "Do not test just after build, lets install and then test" endif override_dh_auto_install: dh_auto_install echo "backend : Agg" >| $(MPLCONFIGDIR)/matplotlibrc : # Only now lets build docs ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS))) mkdir -p docs_sphinx/_static # to avoid crashes with older sphinx (e.g. on jaunty) export PYTHONPATH=$$(/bin/ls -d $(INSTALL_PATH)/usr/lib/$(PYTHON)/*-packages); \ { cd docs_sphinx; sphinx-build -a -E $(SPHINXOPTS) -b html . ../docs; } -rmdir -rf docs_sphinx/_static # remove directory possibly created above rm docs/_static/jquery.js rm -r docs/.doctrees : # objects inventory is of no use for the package rm docs/objects.inv # : # fresh PDF # { cd docs_sphinx/_latexbuild; make clean; make; } endif # All tests later on # cd build to prevent use of local/not-built source tree # IMPORTANT: test_devices **really** needs to be excluded since # brian2.tests.test_devices.test_set_reset_device_implicit ... WARNING Active device does not have an attribute 'previous_devices', ignoring this [brian2.devices.device] # it kills either the build or the system running the build ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) # Remove failing tests # The following test files will be ignored completely. # There are other single test in other testfiles which is patched out in ignore_failing_test.patch # MAKE SURE YOU EXCLUDE test_devices IN ANY CASE (see above!) for ti in test_cpp_standalone \ test_devices \ test_functions \ test_monitor \ test_network \ test_neurongroup \ test_numpy_codegen \ test_poissongroup \ test_refractory \ test_spatialneuron \ test_spikegenerator \ test_stateupdaters \ test_synapses \ test_thresholder \ test_timedarray \ ; do \ find .pybuild -name $${ti}.py -delete ; \ find debian/tmp -name $${ti}.py -delete ; \ done # FIXME: May be the deleted tests should be provided in final binary package! set -e; cd build; \ for PYTHON in $(shell py3versions -r); do \ echo "I: Running Brian unittests using $$PYTHON"; \ PYTHONPATH=$$(/bin/ls -d $(INSTALL_PATH)/usr/lib/$$PYTHON/*-packages) \ $$PYTHON /usr/bin/nosetests3 -v -s -P --ignore-files="test_devices\.py" --exclude='(experimental|modelfitting)' brian2; \ done endif # Everything is relevant for python3-brian pkg -- moving accordingly rm -rf debian/python3-brian mv debian/tmp debian/python3-brian find debian -name "*_cpp.o" -delete ## move binary libraries into -lib override_dh_install: dh_install : # Move platform-specific libraries into -lib set -e; for lib in $$(find $(PACKAGE_ROOT_DIR)/usr -name '*.so'); do \ sdir=$$(dirname $$lib) ; \ tdir=$(PACKAGE_ROOT_DIR)-lib/$${sdir#*$(PACKAGE_NAME)/} ; \ mkdir -p $$tdir ; \ echo "Moving '$$lib' into '$$tdir'." ; \ mv $$lib $$tdir ; \ done if [ -x /usr/bin/dh_numpy3 ]; then dh_numpy3 -ppython3-brian-lib; fi ## 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 ## Some custom rules test_examples: install set -e; cd examples; \ for f in `find -iname *.py`; do echo -n "$$f: "; \ PYTHONPATH=$$(/bin/ls -d $(CURDIR)/build/lib.*-$(PYTHON_VERSION)) MPLCONFIGDIR=../build \ python3 $$f >& $$f.output && echo "Ok" || echo "Failed"; done override_dh_installdocs: pandoc README.rst > README.html dh_installdocs rm README.html # working around sphinx bug #739300 sed -i 's?https://cdnjs.cloudflare.com/ajax/.*/latest.js?file:///usr/share/javascript/mathjax/unpacked/latest.js?g' \ `grep -Rl 'https://cdnjs.cloudflare.com/ajax/.*/latest.js'` find debian -name ".git*" -delete