chiark / gitweb /
Fix up sys.path in scripts
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 9 Apr 2017 14:49:14 +0000 (15:49 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 9 Apr 2017 14:49:14 +0000 (15:49 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
debian/rules
hippotat
hippotatd
subst-sys-path [new file with mode: 0755]

index 97072131a49b20eaee11fa4ebc8f4c5c6ad8c693..17bbf5e9232348187941c673eea61a2a866fe563 100755 (executable)
@@ -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
index 3b25bfdc77c6ad56f624ece432c0e40fb7f5529b..43faf28715e1ab2a27f71b496cf1fc6226f1696a 100755 (executable)
--- a/hippotat
+++ b/hippotat
@@ -21,7 +21,7 @@
 #    along with this program, in the file GPLv3.  If not,
 #    see <http://www.gnu.org/licenses/>.
 
-
+#@ sys.path.append('@PYBUILD_INSTALL_DIR@')
 from hippotatlib import *
 
 import twisted.web
index 248ea44c418695701963cfdb098fac634795b17d..1865dad819a7231b2b743ac071076ec2b0e2f5e6 100755 (executable)
--- a/hippotatd
+++ b/hippotatd
@@ -25,7 +25,7 @@
 #    the file AGPLv3+CAFv2.  If not, email Ian Jackson
 #    <ijackson@chiark.greenend.org.uk>.
 
-
+#@ 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 (executable)
index 0000000..c735104
--- /dev/null
@@ -0,0 +1,5 @@
+#!/usr/bin/perl -pi
+next unless m{^#\@ };
+my $ok = 1;
+s{@(\w+)@}{ $ENV{$1} // ($ok=0, $&) }ge;
+s{^#\@ }{} if $ok;