From 7e0fcaa5b28eb1aa022a59e5056679e7854070b9 Mon Sep 17 00:00:00 2001 From: Rob Browning Date: Sat, 12 Dec 2015 13:30:18 -0600 Subject: [PATCH] Configure python, use it, and embed during install 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 Tested-by: Rob Browning --- Makefile | 21 ++++++++++++++++----- README.md | 6 ++++++ cmd/bloom-cmd.py | 7 ++++++- cmd/cat-file-cmd.py | 7 ++++++- cmd/daemon-cmd.py | 7 ++++++- cmd/damage-cmd.py | 7 ++++++- cmd/drecurse-cmd.py | 7 ++++++- cmd/fsck-cmd.py | 7 ++++++- cmd/ftp-cmd.py | 7 ++++++- cmd/fuse-cmd.py | 7 ++++++- cmd/help-cmd.py | 7 ++++++- cmd/import-duplicity-cmd.py | 7 ++++++- cmd/index-cmd.py | 7 ++++++- cmd/init-cmd.py | 7 ++++++- cmd/join-cmd.py | 7 ++++++- cmd/list-idx-cmd.py | 7 ++++++- cmd/ls-cmd.py | 7 ++++++- cmd/margin-cmd.py | 7 ++++++- cmd/memtest-cmd.py | 7 ++++++- cmd/meta-cmd.py | 7 ++++++- cmd/midx-cmd.py | 7 ++++++- cmd/mux-cmd.py | 7 ++++++- cmd/newliner-cmd.py | 7 ++++++- cmd/on--server-cmd.py | 7 ++++++- cmd/on-cmd.py | 7 ++++++- cmd/random-cmd.py | 7 ++++++- cmd/restore-cmd.py | 7 ++++++- cmd/save-cmd.py | 7 ++++++- cmd/server-cmd.py | 7 ++++++- cmd/split-cmd.py | 7 ++++++- cmd/tag-cmd.py | 7 ++++++- cmd/tick-cmd.py | 7 ++++++- cmd/version-cmd.py | 7 ++++++- cmd/web-cmd.py | 7 ++++++- cmd/xstat-cmd.py | 7 ++++++- config/configure | 12 +++++++++++- main.py | 8 +++++++- t/cleanup-mounts-under | 3 +++ t/hardlink-sets | 7 ++++++- t/id-other-than | 7 ++++++- t/mksock | 7 ++++++- t/ns-timestamp-resolutions | 7 ++++++- t/root-status | 7 ++++++- t/subtree-hash | 7 ++++++- t/unknown-owner | 7 ++++++- wvtest.py | 7 ++++++- 46 files changed, 289 insertions(+), 48 deletions(-) diff --git a/Makefile b/Makefile index daefc08..e49f80d 100644 --- 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)) diff --git a/README.md b/README.md index 7eb4c2d..01c2e5d 100644 --- 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 -------------------- diff --git a/cmd/bloom-cmd.py b/cmd/bloom-cmd.py index cd4506d..b2f909b 100755 --- a/cmd/bloom-cmd.py +++ b/cmd/bloom-cmd.py @@ -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 * diff --git a/cmd/cat-file-cmd.py b/cmd/cat-file-cmd.py index 8948ff2..735a239 100755 --- a/cmd/cat-file-cmd.py +++ b/cmd/cat-file-cmd.py @@ -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 * diff --git a/cmd/daemon-cmd.py b/cmd/daemon-cmd.py index c90e3e4..5149c16 100755 --- a/cmd/daemon-cmd.py +++ b/cmd/daemon-cmd.py @@ -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 * diff --git a/cmd/damage-cmd.py b/cmd/damage-cmd.py index 49dbed0..22bc8f0 100755 --- a/cmd/damage-cmd.py +++ b/cmd/damage-cmd.py @@ -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 * diff --git a/cmd/drecurse-cmd.py b/cmd/drecurse-cmd.py index cdf6680..611bfdb 100755 --- a/cmd/drecurse-cmd.py +++ b/cmd/drecurse-cmd.py @@ -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 diff --git a/cmd/fsck-cmd.py b/cmd/fsck-cmd.py index 794c755..a5ab754 100755 --- a/cmd/fsck-cmd.py +++ b/cmd/fsck-cmd.py @@ -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 * diff --git a/cmd/ftp-cmd.py b/cmd/ftp-cmd.py index baa1e08..1935266 100755 --- a/cmd/ftp-cmd.py +++ b/cmd/ftp-cmd.py @@ -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 * diff --git a/cmd/fuse-cmd.py b/cmd/fuse-cmd.py index 30776cb..3708692 100755 --- a/cmd/fuse-cmd.py +++ b/cmd/fuse-cmd.py @@ -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 * diff --git a/cmd/help-cmd.py b/cmd/help-cmd.py index 56a4148..2efc729 100755 --- a/cmd/help-cmd.py +++ b/cmd/help-cmd.py @@ -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 diff --git a/cmd/import-duplicity-cmd.py b/cmd/import-duplicity-cmd.py index 163d4fa..ff37daf 100755 --- a/cmd/import-duplicity-cmd.py +++ b/cmd/import-duplicity-cmd.py @@ -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 diff --git a/cmd/index-cmd.py b/cmd/index-cmd.py index 6f2adf4..e416ac5 100755 --- a/cmd/index-cmd.py +++ b/cmd/index-cmd.py @@ -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 diff --git a/cmd/init-cmd.py b/cmd/init-cmd.py index 2e4a151..e6cc6b5 100755 --- a/cmd/init-cmd.py +++ b/cmd/init-cmd.py @@ -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 diff --git a/cmd/join-cmd.py b/cmd/join-cmd.py index 042b402..347206d 100755 --- a/cmd/join-cmd.py +++ b/cmd/join-cmd.py @@ -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 * diff --git a/cmd/list-idx-cmd.py b/cmd/list-idx-cmd.py index a3e3dc9..9eb92c1 100755 --- a/cmd/list-idx-cmd.py +++ b/cmd/list-idx-cmd.py @@ -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 * diff --git a/cmd/ls-cmd.py b/cmd/ls-cmd.py index 94a7131..031fbae 100755 --- a/cmd/ls-cmd.py +++ b/cmd/ls-cmd.py @@ -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 * diff --git a/cmd/margin-cmd.py b/cmd/margin-cmd.py index 9b7fd60..ac25ed0 100755 --- a/cmd/margin-cmd.py +++ b/cmd/margin-cmd.py @@ -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 * diff --git a/cmd/memtest-cmd.py b/cmd/memtest-cmd.py index 0e3cf0c..65778b7 100755 --- a/cmd/memtest-cmd.py +++ b/cmd/memtest-cmd.py @@ -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 * diff --git a/cmd/meta-cmd.py b/cmd/meta-cmd.py index cac26b5..671abce 100755 --- a/cmd/meta-cmd.py +++ b/cmd/meta-cmd.py @@ -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 # diff --git a/cmd/midx-cmd.py b/cmd/midx-cmd.py index 6876751..eb558f8 100755 --- a/cmd/midx-cmd.py +++ b/cmd/midx-cmd.py @@ -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 diff --git a/cmd/mux-cmd.py b/cmd/mux-cmd.py index b70c0a8..7a8a9ea 100755 --- a/cmd/mux-cmd.py +++ b/cmd/mux-cmd.py @@ -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 * diff --git a/cmd/newliner-cmd.py b/cmd/newliner-cmd.py index 68d327b..20027ab 100755 --- a/cmd/newliner-cmd.py +++ b/cmd/newliner-cmd.py @@ -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 diff --git a/cmd/on--server-cmd.py b/cmd/on--server-cmd.py index a6f3e21..cdfd441 100755 --- a/cmd/on--server-cmd.py +++ b/cmd/on--server-cmd.py @@ -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 diff --git a/cmd/on-cmd.py b/cmd/on-cmd.py index 9d6f683..df0fdb3 100755 --- a/cmd/on-cmd.py +++ b/cmd/on-cmd.py @@ -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 diff --git a/cmd/random-cmd.py b/cmd/random-cmd.py index 4be3660..7d4c007 100755 --- a/cmd/random-cmd.py +++ b/cmd/random-cmd.py @@ -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 * diff --git a/cmd/restore-cmd.py b/cmd/restore-cmd.py index d527489..c7f446b 100755 --- a/cmd/restore-cmd.py +++ b/cmd/restore-cmd.py @@ -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 * diff --git a/cmd/save-cmd.py b/cmd/save-cmd.py index fc93408..664b580 100755 --- a/cmd/save-cmd.py +++ b/cmd/save-cmd.py @@ -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 diff --git a/cmd/server-cmd.py b/cmd/server-cmd.py index 43a3fce..cf7be26 100755 --- a/cmd/server-cmd.py +++ b/cmd/server-cmd.py @@ -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 * diff --git a/cmd/split-cmd.py b/cmd/split-cmd.py index 70daf7c..b7c7c86 100755 --- a/cmd/split-cmd.py +++ b/cmd/split-cmd.py @@ -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 * diff --git a/cmd/tag-cmd.py b/cmd/tag-cmd.py index f33855e..f12ea4e 100755 --- a/cmd/tag-cmd.py +++ b/cmd/tag-cmd.py @@ -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 diff --git a/cmd/tick-cmd.py b/cmd/tick-cmd.py index 4d462ad..ce3d399 100755 --- a/cmd/tick-cmd.py +++ b/cmd/tick-cmd.py @@ -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 diff --git a/cmd/version-cmd.py b/cmd/version-cmd.py index 645f25f..fbbe24f 100755 --- a/cmd/version-cmd.py +++ b/cmd/version-cmd.py @@ -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 diff --git a/cmd/web-cmd.py b/cmd/web-cmd.py index 1c515e2..acbbb80 100755 --- a/cmd/web-cmd.py +++ b/cmd/web-cmd.py @@ -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 diff --git a/cmd/xstat-cmd.py b/cmd/xstat-cmd.py index 85071d2..c977d1c 100755 --- a/cmd/xstat-cmd.py +++ b/cmd/xstat-cmd.py @@ -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 diff --git a/config/configure b/config/configure index 8003241..a2afb83 100755 --- a/config/configure +++ b/config/configure @@ -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 45a0e8a..ef22957 100755 --- 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 diff --git a/t/cleanup-mounts-under b/t/cleanup-mounts-under index a8ba611..9a72ded 100755 --- a/t/cleanup-mounts-under +++ b/t/cleanup-mounts-under @@ -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): diff --git a/t/hardlink-sets b/t/hardlink-sets index 653b4d2..9dffe14 100755 --- a/t/hardlink-sets +++ b/t/hardlink-sets @@ -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 diff --git a/t/id-other-than b/t/id-other-than index cfa219d..2c0370f 100755 --- a/t/id-other-than +++ b/t/id-other-than @@ -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 diff --git a/t/mksock b/t/mksock index ee2dbfe..6fb19d8 100755 --- 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 diff --git a/t/ns-timestamp-resolutions b/t/ns-timestamp-resolutions index d1bb785..0763127 100755 --- a/t/ns-timestamp-resolutions +++ b/t/ns-timestamp-resolutions @@ -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 diff --git a/t/root-status b/t/root-status index 9fb12cb..5024ed3 100755 --- a/t/root-status +++ b/t/root-status @@ -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 diff --git a/t/subtree-hash b/t/subtree-hash index 691c207..926303f 100755 --- a/t/subtree-hash +++ b/t/subtree-hash @@ -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 diff --git a/t/unknown-owner b/t/unknown-owner index 00442a4..210c5b3 100755 --- a/t/unknown-owner +++ b/t/unknown-owner @@ -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 diff --git a/wvtest.py b/wvtest.py index cc68601..bdd1d79 100755 --- 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. -- 2.39.2