#!/usr/bin/make -f

export MMTK_USE_CYTHON=1
export DH_VERBOSE=1

VERSION := $(shell dpkg-parsechangelog | sed -ne 's/^Version: \(.*\)-.*/\1/p')
PYVERS=$(shell pyversions -vs)

get-orig-source:
	uscan --force-download --upstream-version $(VERSION) --repack

override_dh_auto_clean:
	# remove the cpython generated files distributed by upstream
	rm -f $(patsubst %.pyx,%.c,$(wildcard Src/*.pyx))
	# remove .pyc files
	rm -f $(wildcard Tests/*.pyc)
	# remove the doc
	rm -rf build

override_dh_auto_test:
	dh_auto_test
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
	set -e -x; \
	for py in $(PYVERS); do \
		python$$py setup.py test;\
	done
endif

override_dh_auto_install:
	dh_auto_install
	dh_numpy

%:
	dh $@ --with python2,sphinxdoc

.PHONY: get-orig-source
