#!/usr/bin/make -f

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

export SETUPTOOLS_SCM_PRETEND_VERSION_FOR_CHERRYPY_FOUNDATION := $(DEB_VERSION_UPSTREAM)

# Force use of pyproject.toml
export PYBUILD_SYSTEM=pyproject

# For testing, we need a timezone
export TZ=UTC

%:
	dh $@ --with python3 --buildsystem=pybuild --test-tox

# Install symlink before the test for JavaScript libraries.
override_dh_auto_test:
	dh_auto_test

execute_before_dh_auto_clean:
	rm -rf *.egg-info
# Clean Sphinx build artifacts
	rm -rf build/html docs/_build

# Generate orig.tar.gz
gentarball: SOURCE=cherrypy-foundation
gentarball:
	git archive --format=tar HEAD --prefix=$(SOURCE)-$(DEB_VERSION_UPSTREAM)/ | gzip -9 > ../$(SOURCE)_$(DEB_VERSION_UPSTREAM).orig.tar.gz
	mk-origtargz --compression gzip ../$(SOURCE)_$(DEB_VERSION_UPSTREAM).orig.tar.gz
