#!/usr/bin/make -f

export PYBUILD_NAME=qtile
include /usr/share/dpkg/pkg-info.mk
include /usr/share/dpkg/buildflags.mk
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export PYTHONPATH = $(CURDIR)/debian/python3-qtile
export SETUPTOOLS_SCM_PRETEND_VERSION = $(DEB_VERSION_UPSTREAM)


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

override_dh_auto_test:
ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),)
	xvfb-run dh_auto_test --no-parallel -- --system=custom --test-args="PYTHONPATH={build_dir} {interpreter} -m pytest -v test/backend"
endif

override_dh_installman:
	sphinx-build -C -D project=Qtile -b man docs/ debian/tmp/man
	rm -rf $(CURDIR)/debian/tmp/man/.doctrees/
	dh_installman

override_dh_install:
	dh_install
	mkdir -p $(CURDIR)/debian/qtile/usr/bin/
	mv $(CURDIR)/debian/python3-qtile/usr/bin/qtile $(CURDIR)/debian/qtile/usr/bin/
