| 1 | #! /usr/bin/make -f |
| 2 | # |
| 3 | # debian/rules |
| 4 | # Part of Debian ‘towncrier’ package. |
| 5 | # |
| 6 | # This is free software, and you are welcome to redistribute it under |
| 7 | # certain conditions; see the end of this file for copyright |
| 8 | # information, grant of license, and disclaimer of warranty. |
| 9 | |
| 10 | PACKAGE_NAME = towncrier |
| 11 | |
| 12 | MAIN_PYTHON_PACKAGE = towncrier |
| 13 | |
| 14 | LIBRARY_PACKAGE_NAME = python3-${MAIN_PYTHON_PACKAGE} |
| 15 | DOC_PACKAGE_NAME = ${PACKAGE_NAME}-doc |
| 16 | DOC_DIR = docs |
| 17 | |
| 18 | # Send HTTP traffic to the “discard” service during packaging actions. |
| 19 | export http_proxy = http://127.0.1.1:9/ |
| 20 | export https_proxy = ${http_proxy} |
| 21 | |
| 22 | export PYBUILD_SYSTEM := pyproject |
| 23 | export PYBUILD_NAME = ${MAIN_PYTHON_PACKAGE} |
| 24 | |
| 25 | pybuild_computed_home_dir = $(shell \ |
| 26 | pybuild --print home_dir \ |
| 27 | | cut -d ':' -f 2 \ |
| 28 | | sed -e 's/^[[:space:]]*//' \ |
| 29 | ) |
| 30 | pybuild_computed_build_dir = $(shell \ |
| 31 | pybuild --print build_dir \ |
| 32 | | cut -d ':' -f 2 \ |
| 33 | | sed -e 's/^[[:space:]]*//' \ |
| 34 | ) |
| 35 | |
| 36 | export PYBUILD_INSTALL_ARGS ?= \ |
| 37 | --install-option="--install-layout=deb" |
| 38 | |
| 39 | export PYBUILD_TEST_ARGS = "{dir}"/src/ |
| 40 | |
| 41 | # Twisted Trial creates temporary Python modules and doesn't clean up. |
| 42 | twisted_trial_cruft = ${MAIN_PYTHON_PACKAGE}.test.* |
| 43 | export PYBUILD_AFTER_TEST = $(RM) -r "{build_dir}"/${twisted_trial_cruft} |
| 44 | |
| 45 | # The library package should not install binaries to the default location. |
| 46 | private_bin_dir = $(CURDIR)/usr/share/${PACKAGE_NAME}/bin |
| 47 | export PYBUILD_AFTER_BUILD = \ |
| 48 | mv "{home_dir}/scripts"/* "${private_bin_dir}"/. |
| 49 | |
| 50 | export MAKE ?= make |
| 51 | export RM ?= rm -f |
| 52 | export MKDIR ?= mkdir --parents |
| 53 | |
| 54 | export PYTHON ?= python3 |
| 55 | export SPHINXBUILD ?= $(PYTHON) -m sphinx |
| 56 | SPHINX_MAKE_OPTS ?= SPHINXBUILD="$(SPHINXBUILD)" --directory "${DOC_DIR}" |
| 57 | |
| 58 | |
| 59 | %: |
| 60 | dh $@ --with python3,sphinxdoc --buildsystem=pybuild |
| 61 | |
| 62 | |
| 63 | override_dh_auto_clean: |
| 64 | dh_auto_clean |
| 65 | $(MAKE) ${SPHINX_MAKE_OPTS} clean |
| 66 | |
| 67 | |
| 68 | override_dh_auto_build: ${private_bin_dir} |
| 69 | dh_link -p "${LIBRARY_PACKAGE_NAME}" \ |
| 70 | usr/share/doc/"${LIBRARY_PACKAGE_NAME}" \ |
| 71 | usr/share/doc/"${PACKAGE_NAME}" |
| 72 | dh_link -p "${DOC_PACKAGE_NAME}" \ |
| 73 | usr/share/doc/"${DOC_PACKAGE_NAME}" \ |
| 74 | usr/share/doc/"${PACKAGE_NAME}" |
| 75 | dh_auto_build |
| 76 | $(MAKE) \ |
| 77 | PYTHONPATH="${pybuild_computed_build_dir}" \ |
| 78 | ${SPHINX_MAKE_OPTS} \ |
| 79 | html man |
| 80 | |
| 81 | ${private_bin_dir}: |
| 82 | $(MKDIR) "$@" |
| 83 | |
| 84 | |
| 85 | override_dh_installchangelogs: |
| 86 | dh_installchangelogs NEWS.rst |
| 87 | |
| 88 | |
| 89 | override_dh_installdocs: |
| 90 | dh_installdocs \ |
| 91 | -p "${DOC_PACKAGE_NAME}" \ |
| 92 | --doc-main-package="${PACKAGE_NAME}" |
| 93 | dh_installdocs |
| 94 | |
| 95 | |
| 96 | # Copyright © 2010–2026 Ben Finney <[email protected]> |
| 97 | # |
| 98 | # This is free software: you may copy, modify, and/or distribute this work |
| 99 | # under the terms of the GNU General Public License as published by the |
| 100 | # Free Software Foundation; version 3 of that license or any later version. |
| 101 | # No warranty expressed or implied. |
| 102 | |
| 103 | |
| 104 | # Local variables: |
| 105 | # coding: utf-8 |
| 106 | # mode: gnumakefile |
| 107 | # End: |
| 108 | # vim: fileencoding=utf-8 filetype=make : |