| 1 |
|
| 2 |
|
| 3 |
include /usr/share/dpkg/pkg-info.mk |
| 4 |
|
| 5 |
export PYBUILD_NAME=con-duct |
| 6 |
export PYBUILD_BEFORE_TEST=chmod +x {dir}/test/data/spawn_children.sh |
| 7 |
|
| 8 |
PY3VER := $(shell py3versions -dv) |
| 9 |
|
| 10 |
INSTALLDIR := $(CURDIR)/debian/con-duct |
| 11 |
|
| 12 |
%: |
| 13 |
dh $@ --with python3 --buildsystem=pybuild |
| 14 |
|
| 15 |
override_dh_installman: build/duct.1 |
| 16 |
dh_installman |
| 17 |
|
| 18 |
build/duct.1: |
| 19 |
: # Generate a manpage by running help2man against the installed |
| 20 |
: # `duct` entry point. In 0.20.x `duct` is a tiny shim that execs |
| 21 |
: # `con-duct run`, so we need PATH/PYTHONPATH pointing at the |
| 22 |
: # dh_auto_install destdir for the exec'd binary and the package |
| 23 |
: # metadata to resolve. At this point dh_python3 has not yet |
| 24 |
: # consolidated modules into /usr/lib/python3/dist-packages, so we |
| 25 |
: # must use the per-version path matching the default python3. |
| 26 |
mkdir -p build |
| 27 |
PYTHONPATH=$(INSTALLDIR)/usr/lib/python$(PY3VER)/dist-packages \ |
| 28 |
PATH=$(INSTALLDIR)/usr/bin:$$PATH \ |
| 29 |
help2man --no-info --no-discard-stderr \ |
| 30 |
-n "lightweight wrapper that collects execution data for a command" \ |
| 31 |
--version-string="duct $(DEB_VERSION_UPSTREAM)" \ |
| 32 |
$(INSTALLDIR)/usr/bin/duct >| build/duct.1 |
| 33 |
: # Rewrite the program name from "con-duct run" to "duct" in |
| 34 |
: # synopsis/usage text so the manpage matches the executable users |
| 35 |
: # invoke. Preserve quoted prose mentions like 'con-duct run' so |
| 36 |
: # sentences explaining both names don't collapse to a tautology. |
| 37 |
: # help2man escapes dashes in troff as \-, so match both forms. |
| 38 |
sed -i \ |
| 39 |
-e "s/'con\\\\-duct run'/'__KEEP_CONDUCT_RUN__'/g" \ |
| 40 |
-e 's/con\\-duct run/duct/g' \ |
| 41 |
-e 's/con-duct run/duct/g' \ |
| 42 |
-e "s/'__KEEP_CONDUCT_RUN__'/'con-duct run'/g" \ |
| 43 |
build/duct.1 |
| 44 |
: # Verify that the manpage generated cleanly -- bail out if any |
| 45 |
: # python error or traceback ended up embedded in the troff source. |
| 46 |
! grep -qE 'Traceback|ImportError|ModuleNotFoundError' build/duct.1 |