#!/usr/bin/make -f

export PYBUILD_NAME=xraylarch

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

override_dh_auto_build:
	dh_auto_build
	PYTHONPATH=. http_proxy='127.0.0.1:9' python3 -m sphinx -N -b html doc build/html

override_dh_sphinxdoc:
ifeq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS)))
	dh_sphinxdoc -p python-xraylarch-doc
endif

override_dh_auto_install:
	dh_auto_install
	$(RM) debian/python3-xraylarch/usr/bin/feff6l
	$(RM) debian/python3-xraylarch/usr/bin/feff8l
	find -name gse_xrfmap.ico -exec chmod 0644 {} \;
	find examples/ -executable -type f -exec chmod 0644 {} \;
	dh_install -p python3-xraylarch debian/*.desktop ./usr/share/applications/

override_dh_auto_test:
	true

override_dh_auto_clean:
	dh_auto_clean
	find . -name "*.pyc" -delete
	$(RM) -r .eggs/ log*.dat
	$(RM) -r xraylarch.egg-info