#!/usr/bin/make -f

export PYBUILD_NAME=grip

export PYBUILD_TEST_PYTEST=1
export PYBUILD_BEFORE_TEST=cp {dir}/README.md {build_dir}
export PYBUILD_AFTER_TEST=rm -f {build_dir}/README.md

# pytest arguments:
#
# '-m "not assumption"' prevents external calls to GitHub API
# 'tests/test_cli.py' are functional tests not run at build time (DEP-8)
export PYBUILD_TEST_ARGS=-m "not assumption" --ignore=tests/test_cli.py


%:
	dh $@ --buildsystem=pybuild


execute_after_dh_auto_build:
	txt2man -s 1 -t grip debian/docs/grip.txt > debian/grip.1

override_dh_auto_install:
	dh_auto_install -- --install-args="--install-lib=/usr/share/grip"
	# Move the entry point script to the application root, otherwise it won't
	# work. A symlink for it in '/usr/bin/grip' will be created.
	mv debian/grip/usr/bin/grip debian/grip/usr/share/grip/run
	find debian -name .pytest_cache | xargs rm -Rf
