]> arthur.barton.de Git - bup.git/commitdiff
Configure python, use it, and embed during install
authorRob Browning <rlb@defaultvalue.org>
Sat, 12 Dec 2015 19:30:18 +0000 (13:30 -0600)
committerRob Browning <rlb@defaultvalue.org>
Sat, 12 Dec 2015 19:31:07 +0000 (13:31 -0600)
Search for a "reasonable" python in ./configure (or respect PYTHON), and
use that to create a source tree cmd/python-cmd.sh that all of the
relevant invocations in the source tree respect.

During install, rewrite all of the relevant #! lines to refer to the
./configure selected Python.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
46 files changed:
Makefile
README.md
cmd/bloom-cmd.py
cmd/cat-file-cmd.py
cmd/daemon-cmd.py
cmd/damage-cmd.py
cmd/drecurse-cmd.py
cmd/fsck-cmd.py
cmd/ftp-cmd.py
cmd/fuse-cmd.py
cmd/help-cmd.py
cmd/import-duplicity-cmd.py
cmd/index-cmd.py
cmd/init-cmd.py
cmd/join-cmd.py
cmd/list-idx-cmd.py
cmd/ls-cmd.py
cmd/margin-cmd.py
cmd/memtest-cmd.py
cmd/meta-cmd.py
cmd/midx-cmd.py
cmd/mux-cmd.py
cmd/newliner-cmd.py
cmd/on--server-cmd.py
cmd/on-cmd.py
cmd/random-cmd.py
cmd/restore-cmd.py
cmd/save-cmd.py
cmd/server-cmd.py
cmd/split-cmd.py
cmd/tag-cmd.py
cmd/tick-cmd.py
cmd/version-cmd.py
cmd/web-cmd.py
cmd/xstat-cmd.py
config/configure
main.py
t/cleanup-mounts-under
t/hardlink-sets
t/id-other-than
t/mksock
t/ns-timestamp-resolutions
t/root-status
t/subtree-hash
t/unknown-owner
wvtest.py

index daefc0808edb109bd585e62d9880d7ffcce1c602..e49f80d992406a5746af0505d372e75b7d8e6e6d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -30,8 +30,15 @@ Documentation/all: $(bup_deps)
 $(current_sampledata):
        t/configure-sampledata --setup
 
+PYTHON = $(shell cmd/bup-python -c 'import sys; print sys.executable')
+
+define install-python-bin
+  set -e; \
+  sed -e '1 s|.*|#!$(PYTHON)|; 2,/^# end of bup preamble$$/d' $1 > $2; \
+  chmod 0755 $2;
+endef
+
 INSTALL=install
-PYTHON=python
 PREFIX=/usr
 MANDIR=$(DESTDIR)$(PREFIX)/share/man
 DOCDIR=$(DESTDIR)$(PREFIX)/share/doc/bup
@@ -49,10 +56,11 @@ install: all
          $(INSTALL) -m 0644 \
                Documentation/*.html \
                $(DOCDIR)
-       $(INSTALL) -pm 0755 bup $(BINDIR)
-       $(INSTALL) -pm 0755 \
-               cmd/bup-* \
-               $(LIBDIR)/cmd
+       $(call install-python-bin,bup,"$(BINDIR)/bup")
+       set -e; \
+       for cmd in $$(ls cmd/bup-* | grep -v cmd/bup-python); do \
+         $(call install-python-bin,"$$cmd","$(LIBDIR)/$$cmd") \
+       done
        $(INSTALL) -pm 0644 \
                lib/bup/*.py \
                $(LIBDIR)/bup
@@ -143,6 +151,9 @@ test: all
 
 check: test
 
+cmd/python-cmd.sh: config/configure
+       ./config/configure
+
 cmds: \
     $(patsubst cmd/%-cmd.py,cmd/bup-%,$(wildcard cmd/*-cmd.py)) \
     $(patsubst cmd/%-cmd.sh,cmd/bup-%,$(wildcard cmd/*-cmd.sh))
index 7eb4c2dc8c5cef4954b6936eee07fba46fe1db3b..01c2e5dec649326161d579f95eb29eee8e0fa387 100644 (file)
--- a/README.md
+++ b/README.md
@@ -154,6 +154,12 @@ From source
 
         make install DESTDIR=/opt/bup PREFIX=''
 
+ - The Python executable that bup will use is chosen by ./configure,
+   which will search for a reasonable version unless PYTHON is set in
+   the environment, in which case, bup will use that path.  You can
+   see which Python executable was chosen by looking at the
+   configure output, or examining cmd/python-cmd.sh, and you can
+   change the selection by re-running ./configure.
 
 From binary packages
 --------------------
index cd4506d482c2ac8c10f49accee9065bbf314a031..b2f909bd0d9b7fb8d7cb248b540b2cef190676bb 100755 (executable)
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 import sys, glob, tempfile
 from bup import options, git, bloom
 from bup.helpers import *
index 8948ff2bea844e85a8749a4714c2272e933ba87b..735a2398022b4e64d3c7d4a645a83fd311cab2b0 100755 (executable)
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 import sys, stat
 from bup import options, git, vfs
 from bup.helpers import *
index c90e3e4bb3b9224c3be2039a7760340e28c1c9e8..5149c1602bb166640baee39506e29abf29867f26 100755 (executable)
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 import sys, getopt, socket, subprocess, fcntl
 from bup import options, path
 from bup.helpers import *
index 49dbed07146cac337498de6c960044024af26e76..22bc8f094c3eae3a95f4ccd8a339fc449f2426dd 100755 (executable)
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 import sys, os, random
 from bup import options
 from bup.helpers import *
index cdf66803034bd0f429a869ea75b94ba06f29e25a..611bfdbb3e89bdc3d93d9900fc3b38fc5cb6343d 100755 (executable)
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 
 from os.path import relpath
 from bup import options, drecurse
index 794c755b4c424d468cae7210a8447b16c0b51c0e..a5ab754c131f1715f89e93a86111e10961718f9a 100755 (executable)
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 import sys, os, glob, subprocess
 from bup import options, git
 from bup.helpers import *
index baa1e08d826cb1064f7c15762398a62247d37ddb..19352668ab28a42e9a0fddd4dcac28d62f2d8121 100755 (executable)
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 import sys, os, stat, fnmatch
 from bup import options, git, shquote, vfs, ls
 from bup.helpers import *
index 30776cb36b0013adf0bf49de831b5768baa349f6..3708692975dc9be8dc55675d28268180b98b67ae 100755 (executable)
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 import sys, os, errno
 from bup import options, git, vfs, xstat
 from bup.helpers import *
index 56a4148c745d1d2183c80107a07d8b9132146fe2..2efc729a2e3eb41b10154880b0174352c504b1df 100755 (executable)
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 import sys, os, glob
 from bup import options, path
 
index 163d4faf8101e4ac61d48c258c9c2384d1f67ee5..ff37daf0e99bfd5ab859b601399d450d12f18fb8 100755 (executable)
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 
 from calendar import timegm
 from pipes import quote
index 6f2adf4e581c1dc288babe4bee3525c2f61ea004..e416ac5c988baf04fc39b2be336b104589f5b061 100755 (executable)
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 
 import sys, stat, time, os, errno, re
 from bup import metadata, options, git, index, drecurse, hlinkdb
index 2e4a1513b99c058a1fec43ba0e62091d3ed2158d..e6cc6b51001867aac79494b1501230068a5e1c8d 100755 (executable)
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 import sys
 
 from bup import git, options, client
index 042b4023de5af8ad4cd8425e96292d7346d6fc36..347206da86f5fde814b86e7e2c3f07b7e50ad56d 100755 (executable)
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 import sys
 from bup import git, options, client
 from bup.helpers import *
index a3e3dc96e7f4c695c729699adfb041971508e609..9eb92c177971e474a9fc0307a845a5b8d2b080f6 100755 (executable)
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 import sys, os
 from bup import git, options
 from bup.helpers import *
index 94a7131f61c242f196d393d6a0934ab6d363df9b..031fbaefd7aba78339df53162d66b1773c8ce11d 100755 (executable)
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 import sys
 from bup import git, vfs, ls
 from bup.helpers import *
index 9b7fd60a18efd24ab1801f32bcf02623be0cd3c1..ac25ed0644a9049d76d259572890ac7262b6e638 100755 (executable)
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 import sys, struct, math
 from bup import options, git, _helpers
 from bup.helpers import *
index 0e3cf0c839d6a86402685a8589a0e5c6acf5b1b9..65778b73de374829c1a8eb30e7b74a0c61bac60a 100755 (executable)
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 import sys, re, struct, time, resource
 from bup import git, bloom, midx, options, _helpers
 from bup.helpers import *
index cac26b54242ea5cdb592750bb2353a35ea58eafd..671abce43e99974090caa878ba699055475f7a38 100755 (executable)
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 
 # Copyright (C) 2010 Rob Browning
 #
index 68767513c2c4f571b02456efd8527ce428418b37..eb558f88ca8c0defc932bc2c5ddd8531a600e172 100755 (executable)
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 import sys, math, struct, glob, resource
 import tempfile
 from bup import options, git, midx, _helpers, xstat
index b70c0a8eeaa538c3ca1026afe1753e756d6257dd..7a8a9eac1a9ea950abf350e87b32b0de86363346 100755 (executable)
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 import os, sys, subprocess, struct
 from bup import options
 from bup.helpers import *
index 68d327b7ee6aaac273f522fcc23bd2c4d36c2ba6..20027ab104a1e495b4abff2b9853e1818430b3ed 100755 (executable)
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 import sys, os, re
 from bup import options
 from bup import _helpers   # fixes up sys.argv on import
index a6f3e2188719d7c9e922f03e07c2a4c3ba33046b..cdfd44113c352e3560a521e97d7e915344b7ee07 100755 (executable)
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 import sys, os, struct
 from bup import options, helpers
 
index 9d6f683f357c869597bdb45f3ab1d735fb2e1e1b..df0fdb3158faaf6091bf8977dd054764b66313e6 100755 (executable)
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 import sys, os, struct, getopt, subprocess, signal
 from subprocess import PIPE
 from bup import options, ssh, path
index 4be366063c18c2792baab50fc55606d03703c795..7d4c007611334c64b7ae61425839745f0cea5d69 100755 (executable)
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 import sys
 from bup import options, _helpers
 from bup.helpers import *
index d52748914a52c5fe4943265a1881b4c4e8bd2704..c7f446b44a73d0155b75f4f90084e2a692539797 100755 (executable)
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 import copy, errno, sys, stat, re
 from bup import options, git, metadata, vfs
 from bup.helpers import *
index fc93408c2a5dcc61923d2f7bc18356856c4fe926..664b580176a66c888be1634067abc769255b320e 100755 (executable)
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 import sys, stat, time, math
 from cStringIO import StringIO
 from errno import EACCES
index 43a3fce5c1a0539bb3552be243f8108a0c1c983d..cf7be261c343ab28f720a9feee193ea842a7b3fa 100755 (executable)
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 import os, sys, struct
 from bup import options, git
 from bup.helpers import *
index 70daf7c688258b7da31c34a2bac83015c3316fac..b7c7c86e0e00d24aec141ef2193df76eb43a2838 100755 (executable)
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 import os, sys, time
 from bup import hashsplit, git, options, client
 from bup.helpers import *
index f33855ec7e293b8b98409464a6cb85edf2284e36..f12ea4e473a4349cf13b24f19c087a30be8ca2a5 100755 (executable)
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 
 import sys
 import os
index 4d462ad7fe501188a1843f12062acf037b3a392a..ce3d399c94f9447c6d4cf169ac3ab5baaecca5c8 100755 (executable)
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 import sys, time
 from bup import options
 
index 645f25f5ac68cc848c3daf805f74a7d7ab1a1ebc..fbbe24fee5984fe0007d5ca64e57127342450404 100755 (executable)
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 import sys
 from bup import options
 from bup import _version
index 1c515e2d10d6ddfa0d488311adcd1f73315f11d8..acbbb802a5da1c191caf89353af51370b3665dae 100755 (executable)
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 import sys, stat, urllib, mimetypes, posixpath, time, webbrowser
 import urllib
 from bup import options, git, vfs
index 85071d21a7e232590c1079b8160fa59808587d16..c977d1c62ee5c8dc5fc56501e587456c66030eea 100755 (executable)
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 # Copyright (C) 2010 Rob Browning
 #
 # This code is covered under the terms of the GNU Library General
index 800324137aebeb8dba3aed9a8fa2933da3a9f029..a2afb83778825e55eb42e7ce53dabc054f77b16a 100755 (executable)
@@ -56,8 +56,18 @@ if [ -z "$MAKE_VERSION" ]; then
 fi
 expr "$MAKE_VERSION" '>=' '3.81' || AC_FAIL "ERROR: $MAKE must be >= version 3.81"
 
-if test -z "$(bup_find_prog python '')"; then
+bup_python="$PYTHON"
+test -z "$bup_python" && bup_python="$(bup_find_prog python2.7 '')"
+test -z "$bup_python" && bup_python="$(bup_find_prog python2.6 '')"
+test -z "$bup_python" && bup_python="$(bup_find_prog python2 '')"
+test -z "$bup_python" && bup_python="$(bup_find_prog python '')"
+if test -z "$bup_python"; then
     AC_FAIL "ERROR: unable to find python"
+else
+    echo "#!/bin/sh" > ../cmd/python-cmd.sh
+    printf "exec %q \"\$@\"" "$bup_python" >> ../cmd/python-cmd.sh
+    chmod u+x ../cmd/python-cmd.sh
+    cd ../cmd && ln -sf python-cmd.sh bup-python
 fi
 
 if test -z "$(bup_find_prog git '')"; then
diff --git a/main.py b/main.py
index 45a0e8a14ae30b62013d0fe187ff94f0348c35b2..ef229571714926cfb41b09f0448d94e595e628e9 100755 (executable)
--- a/main.py
+++ b/main.py
@@ -1,4 +1,10 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*- # -*-python-*-
+bup_python="$(dirname "$0")/cmd/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
+
 import sys, os, subprocess, signal, getopt
 
 argv = sys.argv
index a8ba61158cb528b4c53f536243e6a071354baaf5..9a72dedd87dba85722a703e8cb25fbe8c2dc2d91 100755 (executable)
@@ -1,5 +1,8 @@
 #!/usr/bin/env python
 
+# This cannot rely on bup-python because it runs during clean, and so
+# it also needs to be compatible with Python 2 and 3.
+
 import os.path, re, subprocess, sys
 
 def mntent_unescape(x):
index 653b4d2e682423d8d74541874bb25b6c6aabc731..9dffe1410060be110e55a11a77b122ad190863bc 100755 (executable)
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/../cmd/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 
 import os, stat, sys
 
index cfa219d4025fa763173596d586928608e3545d84..2c0370f3697afce22c61bdfeea473b09e6d2a5c6 100755 (executable)
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/../cmd/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 
 import grp
 import pwd
index ee2dbfe381c1ee2c72899000b28768b7b730bbfa..6fb19d8c3fad4bdaa19e78bec4aae362167156c9 100755 (executable)
--- a/t/mksock
+++ b/t/mksock
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/../cmd/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 
 import socket, sys
 
index d1bb785a6009803097604442feb1304dc1a0a1f3..07631276c1e441e58b28bb2e704ed87073a3d048 100755 (executable)
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/../cmd/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 
 import os, sys
 
index 9fb12cb2c4411a2d87e5c7d823061c231a5cb233..5024ed3afb29b1976c5dfc4635542895adf34ccf 100755 (executable)
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/../cmd/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 
 import sys
 
index 691c207be6f9806206777fd94eb13414ca344af9..926303f4f2acb30c1e3af03d49d3d20abc2342c9 100755 (executable)
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/../cmd/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 
 import os, sys
 
index 00442a42e83ade4e624eb8e9c59caf0d3309f8fc..210c5b3fe41350f3edaae673fb5b241bd5347127 100755 (executable)
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/../cmd/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 
 import grp
 import pwd
index cc68601ccd6b5c95ab24546887ebf2f0f31f1258..bdd1d79319290a333e8d1db328fa74cec21e1cdd 100755 (executable)
--- a/wvtest.py
+++ b/wvtest.py
@@ -1,4 +1,9 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+export PATH="$(dirname "$0")/cmd:$PATH"
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 #
 # WvTest:
 #   Copyright (C)2007-2012 Versabanq Innovations Inc. and contributors.