File: rules

package info (click to toggle)
python-userpath 1.4.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 232 kB
  • sloc: python: 814; makefile: 18; sh: 3
file content (30 lines) | stat: -rwxr-xr-x 962 bytes parent folder | download
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
#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk

# detect if build targets experimental suite (or is a draft)
DEB_SUITE_EXP = $(filter experimental% UNRELEASED,$(DEB_DISTRIBUTION))


cmd = userpath
_ENV = $(strip \
 PATH="$(CURDIR)/debian/tmp/usr/bin:$(PATH)" \
 PYTHONPATH="$(CURDIR)/debian/tmp/usr/lib/$(shell py3versions -d)/dist-packages")

# generate manpage with help2man from --help option of python script
_mkman = $(_ENV) \
 help2man $(if $3,--name "$(strip $3)") --no-info --version-string $(DEB_VERSION_UPSTREAM) --output $2 $1 \
 || { $(_ENV) $1 --help; false; }

%:
	dh $@ --buildsystem=pybuild

override_dh_auto_test:
	dh_auto_test $(if $(DEB_SUITE_EXP),|| true)

# * generate manpage based on --help option of script itself
execute_after_dh_auto_install:
	$(call _mkman, $(cmd), debian/$(cmd).1, \
		tool for adding locations to the user PATH)
	find debian/tmp/usr/lib -name '*.pyc' -delete
	find debian/tmp/usr/lib -type d -empty -delete