#!/usr/bin/make -f

export PYBUILD_INSTALL_ARGS = --install-scripts /usr/share/games/pysolfc \
                              --install-lib /usr/share/games/pysolfc

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

# In this context, 'rules' are solitaire game rules in html form.
# 'all_games.html' does require the rules to be built first.
# 'make mo' builds localization and the rest is handled by pybuild.
override_dh_auto_build:
	make rules
	cd data/html && PYTHONPATH=../.. ../../scripts/all_games.py html id rules/ > all_games.html
	make mo
	dh_auto_build

override_dh_install:
	dh_install
	# Avoid conflicting with the separate package pysolfc-cardsets.
	rm -r debian/pysolfc/usr/share/games/pysolfc/cardset-hanafuda-200-years/
	# We install the docs to /usr/share/doc using dh_install, so we need to
	# rm the original directory, and later on dh_link will create a symlink.
	rm -r debian/pysolfc/usr/share/games/pysolfc/html/

# Only run import tests for now. Missing deps for running the full suite:
# python3-pycotap, python3-flake8-import-order, libtest-trailingspace-perl,
# libcode-tidyall-plugin-flake8-perl
override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	TEST_TAGS=SKIP_PY2 python3 scripts/gen_individual_importing_tests.py
	PYTHONPATH=. prove tests/individually-importing/*.py
endif
