#!/usr/bin/make -f
BACKUP_JQUERY_UI_IMAGES = mv trac/htdocs/css/jquery-ui/images debian/images.backup; touch trac/htdocs/css/jquery-ui/images
RESTORE_JQUERY_UI_IMAGES = rm -f trac/htdocs/css/jquery-ui/images; mv debian/images.backup trac/htdocs/css/jquery-ui/images 

%:
	dh $@ --with python2 --buildsystem=python_distutils

override_dh_compress:
	dh_compress -X.py -X-hook

override_dh_fixperms:
	dh_fixperms
	find debian/trac/usr/lib/python2.7/dist-packages/trac -type f -print0 2>/dev/null | xargs -0r chmod 644
	chmod 755 debian/trac/usr/lib/python2.7/dist-packages/trac/admin/templates/deploy_trac.*
	chmod 755 debian/trac/usr/lib/python2.7/dist-packages/trac/web/*_frontend.py

override_dh_auto_install:
	$(BACKUP_JQUERY_UI_IMAGES)
	dh_auto_install --buildsystem=python_distutils
	$(RESTORE_JQUERY_UI_IMAGES)

override_dh_auto_build:
	$(BACKUP_JQUERY_UI_IMAGES)
	dh_auto_build --buildsystem=python_distutils
	$(RESTORE_JQUERY_UI_IMAGES)
