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

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

%:
	dh $@ --with python2

override_dh_clean:
	### clean files created during tests
	find . -name "*.pyc" -exec rm {} \;
	rm -rf config
	### remove the build dir
	rm -rf build
	### keep on cleaning
	dh_clean


PIXMAPDIR = debian/geophar/usr/share/pixmaps
override_dh_install:
	dh_install
	# install an icon
	install -d $(PIXMAPDIR)
	install -m 644 debian/geophar.png $(PIXMAPDIR)/geophar.png
	#######################################################
	# replace javascript libraries which were bundled in the 
	# upstream package by symlinks
	#######################################################

	###################### jsMath #########################
	ln -s /usr/share/jsmath \
	  debian/geophar/usr/share/geophar/wxgeometrie/doc/html/_static/jsMath

	# remove extra license files
	find debian/geophar -name "LICENSE" -exec rm {} \;
	find debian/geophar -name "license*" -exec rm {} \;
	# fix a few wrong permissions
	find debian/geophar -name "*.py" -exec chmod 644 {} \;
	chmod 644 debian/geophar/usr/share/geophar/tools/bash_autocompletion
	chmod 755 debian/geophar/usr/share/geophar/tools/resources/geophar
	# remove files which cannot be compiled by phython 2
	rm -rf debian/geophar/usr/share/geophar/wxgeometrie/sympy/mpmath/tests
	rm -f debian/geophar/usr/share/geophar/wxgeometrie/sympy/mpmath/libmp/exec_py3.py
