| 1 |
#!/usr/bin/make -f |
| 2 |
|
| 3 |
ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES))) |
| 4 |
DH_FLAGS += --with sphinxdoc |
| 5 |
endif |
| 6 |
|
| 7 |
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) |
| 8 |
NUMJOBS := $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) |
| 9 |
TEST_FLAGS += --threads=$(intcmp $(NUMJOBS),12,$(NUMJOBS),12) |
| 10 |
endif |
| 11 |
|
| 12 |
# Use the --fast option to allow tests to finish as soon as the output matches |
| 13 |
# the expected output. This turns the --wait option into a timeout rather than |
| 14 |
# a time that has to be waited on each test. |
| 15 |
TEST_FLAGS += --wait=20 --fast |
| 16 |
|
| 17 |
ifndef PYBUILD_AUTOPKGTEST |
| 18 |
PYBUILD_BEFORE_TEST=ln -s {dir}/crazy-complete {build_dir} |
| 19 |
else |
| 20 |
PYBUILD_BEFORE_TEST=ln -s /usr/bin/crazy-complete {build_dir} |
| 21 |
endif |
| 22 |
|
| 23 |
export PYBUILD_TEST_CUSTOM=1 |
| 24 |
export PYBUILD_TEST_ARGS=test/run.sh --driver=tmux $(TEST_FLAGS) || (diff -u test/tests/tests.yaml test/tests/tests.new.yaml; exit 1) |
| 25 |
export PYBUILD_BEFORE_TEST |
| 26 |
export PYBUILD_AFTER_TEST=rm {build_dir}/crazy-complete |
| 27 |
|
| 28 |
%: |
| 29 |
dh $@ --with python3 --with shell_completions --buildsystem=pybuild $(DH_FLAGS) |
| 30 |
|
| 31 |
# Force TZ to UTC so that the date in the manpage HISTORY section (from |
| 32 |
# $SOURCE_DATE_EPOCH) is formatted with a known timezone. Otherwise the |
| 33 |
# date may shift which can break reproducibility. |
| 34 |
# TODO: This workaround should be fixed in argparse-manpage. |
| 35 |
# See-Also: https://bugs.debian.org/1126092 |
| 36 |
execute_before_dh_installman: |
| 37 |
ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES))) |
| 38 |
PYTHONPATH=. TZ=Etc/UTC argparse-manpage \ |
| 39 |
--description="Generate auto completion files for all major shells" \ |
| 40 |
--author="Benjamin Abendroth" \ |
| 41 |
--pyfile=crazy-complete \ |
| 42 |
--object=p \ |
| 43 |
> crazy-complete.1 |
| 44 |
endif |
| 45 |
|
| 46 |
execute_before_dh_installdocs: |
| 47 |
ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES))) |
| 48 |
PYTHONPATH=. python3 -m sphinx -N -bhtml docs/ build/html |
| 49 |
endif |