Commit d47e6e26 authored by Jonas Smedegaard's avatar Jonas Smedegaard

Tidy: Generalize setting environment variables.

parent c1708279
......@@ -3,38 +3,39 @@
include /usr/share/dpkg/pkg-info.mk
cmd = ontospy
python3path = debian/tmp/usr/lib/$(shell py3versions -d)/dist-packages
python3path_build = .pybuild/cpython3_$(shell py3versions -dv)/build
path_build = build/scripts-$(shell py3versions -dv):$(PATH)
_ENV = $(strip \
PATH="$(CURDIR)/build/scripts-$(shell py3versions -dv):$(PATH)" \
PYTHONPATH="$(CURDIR)/.pybuild/cpython3_$(shell py3versions -dv)/build")
_ENV_staged = $(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 = PYTHONPATH=$(python3path) \
_mkman = $(_ENV) \
help2man $(patsubst %,--name %,$3) --no-info --version-string $(DEB_VERSION_UPSTREAM) --output $2 $1 \
|| { PYTHONPATH=$(python3path) $1 --help; false; }
|| { $(_ENV) $1 --help; false; }
# generate shell completion scripts
override_dh_auto_build:
dh_auto_build --buildsystem=pybuild
PATH="$(path_build)" PYTHONPATH="$(python3path_build)" \
_ONTOSPY_COMPLETE=source $(cmd) \
$(_ENV) _ONTOSPY_COMPLETE=source $(cmd) \
> debian/bash-completion || true
PATH="$(path_build)" PYTHONPATH="$(python3path_build)" \
_ONTOSPY_COMPLETE=source_zsh $(cmd) \
$(_ENV) _ONTOSPY_COMPLETE=source_zsh $(cmd) \
> debian/_$(cmd) || true
# check shell script
# * try but distrust upstream testsuite
override_dh_auto_test:
dh_auto_test --buildsystem=pybuild || true
PATH="$(path_build):$(PATH)" PYTHONPATH="$(python3path_build)" \
prove debian/tests/*.t
$(_ENV) prove debian/tests/*.t
shellcheck --shell bash --exclude=SC2086,SC2206,SC2207,SC2235 \
debian/bash-completion
# generate manpage based on --help option of script itself
override_dh_auto_install: _ENV = $(_ENV_staged)
override_dh_auto_install:
dh_auto_install --buildsystem=pybuild
$(call _mkman, debian/tmp/usr/bin/$(cmd), debian/$(cmd).1, \
$(call _mkman, $(cmd), debian/$(cmd).1, \
command-line tool to inspect and visualize RDF models)
find debian/tmp/usr/lib -name '*.pyc' -delete
find debian/tmp/usr/lib -type d -empty -delete
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment