1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
|
#! /usr/bin/make -f
#
# debian/rules
# Part of the Debian ‘python-coverage’ 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.
export DEB_BUILD_MAINT_OPTIONS = hardening=+bindnow
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
export PYBUILD_NAME = coverage
export PYBUILD_DISABLE = test
export PYBUILD_SYSTEM = distutils
PYTHON3_PACKAGE_NAME = python3-${PYBUILD_NAME}
package_working_root = debian
package_install_root = debian/{package}
DISTRIBUTION_NAME = coverage
HTMLFILES_DIR = ${DISTRIBUTION_NAME}/htmlfiles
htmlfiles_dirname = $(notdir ${HTMLFILES_DIR})
RESOURCES_DIR = usr/share/{package}
package_install_resources_root = ${package_install_root}/${RESOURCES_DIR}
DOCUMENTATION_DIR = doc
MANPAGE_SUFFIX = .1
manpage_tempfile_suffix = ${MANPAGE_SUFFIX}.tmp
default_manpage_name = python-coverage${MANPAGE_SUFFIX}
python_command_path = ${package_install_root}/usr/bin/python-coverage
python3_command_names = $(sort $(notdir $(wildcard \
${package_working_root}/*/usr/bin/python3*-coverage)))
versioned_command_names = ${python3_command_names}
versioned_manpage_names = $(addsuffix ${MANPAGE_SUFFIX}, \
${versioned_command_names})
versioned_manpage_paths = $(addprefix ${DOCUMENTATION_DIR}/, \
${versioned_manpage_names})
GENERATED_FILES += ${DOCUMENTATION_DIR}/*${MANPAGE_SUFFIX}
GENERATED_FILES += ${DOCUMENTATION_DIR}/*${manpage_tempfile_suffix}
DOCUMENTATION_BUILD_DIR = ${DOCUMENTATION_DIR}/_build
DOCUMENTATION_BUILD_HTML_DIR = ${DOCUMENTATION_BUILD_DIR}/html
DOCUMENTATION_BUILD_PYCACHE_DIR = ${DOCUMENTATION_BUILD_HTML_DIR}/_static/__pycache__
GENERATED_FILES += ${DOCUMENTATION_BUILD_DIR}
INSTALL = install
MV = mv
CP = cp
# Send HTTP traffic to the “discard” service during packaging actions.
export http_proxy = http://127.0.1.1:9/
export https_proxy = ${http_proxy}
RST_SUFFIX = .txt
RST2MAN = rst2man
SPHINX = python3 -m sphinx
SPHINX_OPTS = -N
FIX_SHEBANG = debian/fix_shebang
%:
dh $@ --with python3,sphinxdoc --buildsystem=pybuild
.PHONY: manpage-aliases
manpage-aliases: ${versioned_manpage_paths}
${DOCUMENTATION_DIR}:
$(INSTALL) --directory "$@"
${DOCUMENTATION_DIR}/${default_manpage_name}: ${DOCUMENTATION_DIR}
${DOCUMENTATION_DIR}/${default_manpage_name}: ${package_working_root}/${default_manpage_name}
$(INSTALL) --mode=u=rw,go=r "$<" "$@"
${DOCUMENTATION_DIR}/%${MANPAGE_SUFFIX}: ${DOCUMENTATION_DIR}/${default_manpage_name}
$(INSTALL) --mode=u=rw,go=r "$<" "$@"
%.1: %.1${RST_SUFFIX}
$(RST2MAN) "$<" > "$@".tmp
cat debian/manpage_encoding_declaration.UTF-8 "$@".tmp > "$@"
override_dh_auto_build:
dh_auto_build --buildsystem=pybuild
$(SPHINX) ${SPHINX_OPTS} -bhtml ${DOCUMENTATION_DIR}/ \
${DOCUMENTATION_BUILD_HTML_DIR}/
$(RM) -r ${DOCUMENTATION_BUILD_PYCACHE_DIR}/
# Upstream test suite doesn't currently run in our build environment.
override_dh_auto_test:
export PYBUILD_AFTER_INSTALL = \
$(INSTALL) --mode=u=rwx,go=rx --directory \
"${package_install_resources_root}" ; \
$(INSTALL) --mode=u=rwx,go=rx --directory \
"${package_install_resources_root}/${htmlfiles_dirname}" ; \
$(INSTALL) --mode=u=rw,go=r "${HTMLFILES_DIR}"/* \
"${package_install_resources_root}/${htmlfiles_dirname}" ; \
dh_link \
--package={package} \
"/${RESOURCES_DIR}/${htmlfiles_dirname}" \
{install_dir}/${HTMLFILES_DIR} ; \
$(CP) ${python_command_path} \
${package_install_root}/usr/bin/python{version}-coverage ; \
$(FIX_SHEBANG) --interpreter 'usr/bin/python{version}' \
${package_install_root}/usr/bin/python{version}-coverage ; \
$(MV) ${python_command_path} \
${package_install_root}/usr/bin/python{version.major}-coverage ; \
$(FIX_SHEBANG) --interpreter 'usr/bin/python{version.major}' \
${package_install_root}/usr/bin/python{version.major}-coverage
override_dh_installchangelogs:
dh_installchangelogs CHANGES.rst
override_dh_installman: manpage-aliases
dh_installman
override_dh_auto_clean:
dh_auto_clean
$(RM) -r ${GENERATED_FILES}
# Copyright © 2010–2024 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.
# Local variables:
# coding: utf-8
# mode: makefile
# End:
# vim: fileencoding=utf-8 filetype=make :
|