#!/usr/bin/make -f

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

override_dh_installchangelogs:
	dh_installchangelogs doc/ChangeLog_Wapiti

override_dh_auto_build:
	# rebuild the *.mo
	rm -f wapitiCore/config/language/*/LC_MESSAGES/wapiti.mo
	cd wapitiCore/language_sources; \
	for f in *.po; do \
	    lang=$$(echo $$f | cut -d '.' -f1); \
	    if [ $$lang != sav_en ]; then \
	        msgfmt $$f -o "../config/language/$$lang/LC_MESSAGES/wapiti.mo"; \
	    fi; \
	done

	dh_auto_build

override_dh_install:
	dh_install
	find $(CURDIR)/debian/wapiti -type d -empty -delete
	find $(CURDIR)/debian/wapiti -type f -name "*.js" -exec chmod -x {} \;


override_dh_auto_test:
	dh_auto_test || true
