#!/usr/bin/make -f

# Explicitly set LC_ALL (LC_CTYPE isn't enough) to ensure Python3
# generates UTF-8 files by default. This should no longer be needed when
# distutils is fixed, see http://bugs.python.org/issue9561
export LC_ALL=C.UTF-8

%:
	dh $@ --with python2,python3

override_dh_auto_build:

override_dh_auto_install:
	python $(CURDIR)/setup.py install --no-compile -O0 --install-layout=deb \
	       --root $(CURDIR)/debian/python-stdnum
	python3 $(CURDIR)/setup.py install --no-compile -O0 --install-layout=deb \
	       --root $(CURDIR)/debian/python3-stdnum
	dh_install

override_dh_auto_test:
	dh_auto_test
ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),)
	set -ex; \
	  for py in $(shell pyversions -r) $(shell py3versions -r); \
	  do \
	    rm -rf $(CURDIR)/coverage; \
	    $$py $(CURDIR)/setup.py nosetests; \
	  done
endif
