#!/usr/bin/make -f
# -*- makefile -*-

## Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

export PYBUILD_NAME=lmfit

# copy the tests to the build dir to be able to pass nose
export PYBUILD_BEFORE_TEST=cp -r NIST_STRD {build_dir}
export PYBUILD_AFTER_TEST=rm -fr {build_dir}/NIST_STRD

%:
	dh $@ --with python3,sphinxdoc --buildsystem=pybuild

override_dh_clean:
	rm -rf doc/_static/conf_interval2.png
	rm -rf doc/_static/conf_interval.png
	dh_clean

# override_dh_auto_build:
# 	dh_auto_build
# 	PYTHONPATH=. http_proxy='localhost' python3 -m sphinx -N -bhtml doc/ build/html  # HTML generator

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	find .pybuild -name build -type d -exec ln -s $(CURDIR)/examples \{\} \;
	dh_auto_test
	find . -name "*.sav" -delete
endif

overwrite_dh_auto_install:
	dh_auto_install
	dh_numpy3

# override_dh_installdocs-indep:
# 	dh_installdocs -i
# 	dh_installdocs build/html -p python-lmfit-doc --doc-main-package=python3-lmfit
# 	find debian/python-$(PYBUILD_NAME)-doc/usr/share/doc -name "*.html" -type f | xargs sed -i 's;https://cdn[js]*\..*/MathJax.js;_static/MathJax.js;g'
# 	ln -s /usr/share/javascript/mathjax/MathJax.js  debian/python-$(PYBUILD_NAME)-doc/usr/share/doc/python-$(PYBUILD_NAME)/html/_static

override_dh_python3:
	dh_python3
	find . -name python3.7 -type d | xargs rm -rf
