From: Ian Jackson Date: Sun, 9 Apr 2017 14:49:14 +0000 (+0100) Subject: Fix up sys.path in scripts X-Git-Tag: hippotat/1.0.0~55^2~62 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=hippotat.git;a=commitdiff_plain;h=a571ef2d5e5929225f8874a9e3f819c43d21b534;ds=sidebyside Fix up sys.path in scripts Signed-off-by: Ian Jackson --- diff --git a/debian/rules b/debian/rules index 9707213..17bbf5e 100755 --- a/debian/rules +++ b/debian/rules @@ -1,5 +1,7 @@ #!/usr/bin/make -f +SHELL=/bin/bash + export PYBUILD_INSTALL_DIR=/usr/share/hippotat/python3 %: @@ -7,3 +9,7 @@ export PYBUILD_INSTALL_DIR=/usr/share/hippotat/python3 debian/copyright: COPYING AGPLv3+CAFv2 cat $^ >$@.tmp && mv -f $@.tmp $@ + +override_dh_compress: + find debian/hippotat/usr/{bin,sbin} -type f | xargs ./subst-sys-path + dh_compress diff --git a/hippotat b/hippotat index 3b25bfd..43faf28 100755 --- a/hippotat +++ b/hippotat @@ -21,7 +21,7 @@ # along with this program, in the file GPLv3. If not, # see . - +#@ sys.path.append('@PYBUILD_INSTALL_DIR@') from hippotatlib import * import twisted.web diff --git a/hippotatd b/hippotatd index 248ea44..1865dad 100755 --- a/hippotatd +++ b/hippotatd @@ -25,7 +25,7 @@ # the file AGPLv3+CAFv2. If not, email Ian Jackson # . - +#@ sys.path.append(@PYBUILD_INSTALL_DIR@) from hippotatlib import * import os diff --git a/subst-sys-path b/subst-sys-path new file mode 100755 index 0000000..c735104 --- /dev/null +++ b/subst-sys-path @@ -0,0 +1,5 @@ +#!/usr/bin/perl -pi +next unless m{^#\@ }; +my $ok = 1; +s{@(\w+)@}{ $ENV{$1} // ($ok=0, $&) }ge; +s{^#\@ }{} if $ok;