#!/usr/bin/make -f
export DH_VERBOSE=1

include /usr/share/dpkg/pkg-info.mk

export PYBUILD_NAME=feedparser

export PYBUILD_AFTER_INSTALL=chmod a-x {destdir}/usr/lib/{interpreter}/dist-packages/feedparser-$(DEB_VERSION_UPSTREAM).egg-info/*

%:
	dh $@ --with python2,python3 --buildsystem pybuild

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	cd feedparser && python ./feedparsertest.py
	# FIXME: run tests for python3 too.  This requires running 2to3 over
	# feedparsertest.py also, and then running it against the already
	# converted feedparser.py, but still being able to find the test
	# directory.
else
	@echo "nocheck set, not running tests"
endif

override_dh_installdocs:
	dh_installdocs -Xtests

override_dh_installchangelogs:
	dh_installchangelogs NEWS

override_dh_fixperms:
	dh_fixperms
	chmod a-x debian/python3-feedparser/usr/lib/python*/dist-packages/feedparser_debian/*.py
