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 9707213..17bbf5e 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 3b25bfd..43faf28 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 248ea44..1865dad 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;