#! /usr/bin/make -f
#
# debian/rules
# Part of Debian ‘dput’ package.
#
# This is free software, and you are welcome to redistribute it under
# certain conditions; see the end of this file for copyright
# information, grant of license, and disclaimer of warranty.

PACKAGE_NAME = dput

export LC_ALL := C.UTF-8
export PYTHONIOENCODING := utf-8

export PYBUILD_SYSTEM := pyproject
export PYBUILD_TEST_CUSTOM := make test --verbose

package_share_dir = usr/share/${PACKAGE_NAME}

INSTALL ?= install
MV ?= mv


%:
	dh $@ --with=bash-completion,python3 --buildsystem=pybuild


override_dh_clean:
	dh_clean
	make clean

# Python packaging tools apparently don't allow specifying correct paths
# where to install these files. We move them afterward as a work-around.
export PYBUILD_AFTER_INSTALL = \
	$(INSTALL) --mode=u=rwx,go=rx --directory \
	    "{destdir}/${package_share_dir}" ; \
	$(MV) "{destdir}"/usr/lib/python*/dist-packages/dput \
	    "{destdir}/${package_share_dir}"/. ; \
	$(MV) "{destdir}"/usr/bin/* \
	    "{destdir}/${package_share_dir}"/.

override_dh_auto_test:
	dh_auto_test -O--buildsystem=makefile

override_dh_installman:
	dh_installman --language=C


# Copyright © 2015–2026 Ben Finney <bignose@debian.org>
#
# This is free software: you may copy, modify, and/or distribute this work
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; version 3 of that license or any later version.
# No warranty expressed or implied. See the file ‘LICENSE.GPL-3’ for details.


# Local variables:
# coding: utf-8
# mode: makefile
# End:
# vim: fileencoding=utf-8 filetype=make :
