#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

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

DESTDIR = $(CURDIR)/debian/wxglade
VERSION = $(shell dpkg-parsechangelog --show-field Version | sed 's/-.*//')

%:
	dh $@ --with python3

override_dh_auto_clean:
	# the installation is simplified drastically!
	rm -f Makefile setup.py version.py
	rm -rf wxGlade.egg-info .eggs
	rm -f docs/html/_static/jquery.js docs/html/_static/underscore.js
	dh_auto_clean

override_dh_auto_test:
	echo "not running the tests since the test tests/test_gui.py will fail"

override_dh_auto_install:
	ln -s underscore-1.3.1.js docs/html/_static/underscore.js
	ln -s jquery-3.1.0.js docs/html/_static/jquery.js
	echo "__version__ = '$(VERSION)'" > $(CURDIR)/version.py
	dh_auto_install

override_dh_fixperms:
	dh_fixperms
	rm -f $(DESTDIR)/usr/share/wxglade/LICENSE.txt
	ln -s ../doc/wxglade/copyright $(DESTDIR)/usr/share/wxglade/LICENSE.txt
	find $(DESTDIR)/usr/share/wxglade -type f | xargs chmod 644
