#!/usr/bin/make -f

export DH_VERBOSE=1
export PYBUILD_NAME=xraylarch

%:
	dh $@ --buildsystem=pybuild


execute_after_dh_auto_clean:
	find . -name "*.pyc" -delete
	$(RM) -rf .eggs/ log*.dat
	$(RM) -rf xraylarch.egg-info
	$(RM) -rf doc/_build

execute_after_dh_auto_build:
ifeq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS)))
	# build the doc
	env PYTHONPATH=$(shell pybuild --build -i python3 -s custom --build-args 'echo {build_dir}') \
	SPHINXBUILD="python3 -m sphinx" \
	SPHINXOPTS="-D mathjax_path=MathJax.js" \
	$(MAKE) -C doc html
endif

execute_after_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/

# not test for now
override_dh_auto_test:
