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

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

PACKAGE = bkchem
DESTDIR = $(CURDIR)/debian/$(PACKAGE)

export PYBUILD_INSTALL_ARGS=--install-lib=/usr/share/$(PACKAGE)/

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

execute_after_dh_auto_build:
	mkdir -p doc/html; cd doc; docbook2html doc.xml -o html
	cd locale/pot; ./compile_l10ns.sh

execute_after_dh_auto_install:
	$(RM) $(DESTDIR)/usr/share/$(PACKAGE)/bkchem/plugins/plugins/code_to_convert_to_plugins.py
	# replace the executable with our own that won't contain the build dir
	$(RM) $(DESTDIR)/usr/bin/bkchem
	# fix the paths in the site_config.py to remove the build dir
	sed -i "s@$(DESTDIR)@@" $(DESTDIR)/usr/share/bkchem/bkchem/site_config.py
	$(RM) -r $(DESTDIR)/usr/share/doc/bkchem/api \
	         $(DESTDIR)/usr/share/doc/bkchem/INSTALL \
	         $(DESTDIR)/usr/share/doc/bkchem/RELEASE

override_dh_auto_test:
	# No test suite for bkchem