]> arthur.barton.de Git - bup.git/commitdiff
Change remaining uses of python to bup-python
authorRob Browning <rlb@defaultvalue.org>
Tue, 15 Dec 2015 01:23:45 +0000 (19:23 -0600)
committerRob Browning <rlb@defaultvalue.org>
Fri, 18 Dec 2015 18:55:08 +0000 (12:55 -0600)
Putting a phony python in tmp-bin and running this:

  PATH="$(pwd)/../tmp-bin:${PATH}" make check

when configure had settled on python2.7 revealed a number of lingering
occurrences.

Thanks to Thomas Klausner for reporting the problem.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
t/lib.sh
t/test-fuse.sh
t/test-ls.sh
t/test-meta.sh
t/test-restore-map-owner.sh
t/test-sparse-files.sh

index 84b942137f882aaf138c47e05d867c5a8c7f113e..e9dc25e3cecb62125801894ba9c093d68786c3c3 100644 (file)
--- a/t/lib.sh
+++ b/t/lib.sh
@@ -1,6 +1,11 @@
 # Assumes shell is Bash, and pipefail is set.
 
-bup_t_lib_script_home=$(cd "$(dirname $0)" && pwd)
+bup_t_lib_script_home=$(cd "$(dirname $0)" && pwd) || exit $?
+
+bup-python()
+{
+    "$bup_t_lib_script_home/../cmd/bup-python" "$@"
+}
 
 force-delete()
 {
@@ -11,7 +16,7 @@ realpath()
 {
     test "$#" -eq 1 || return $?
     echo "$1" | \
-        PYTHONPATH="$bup_t_lib_script_home/../lib" python -c \
+        PYTHONPATH="$bup_t_lib_script_home/../lib" bup-python -c \
         "import sys, bup.helpers; print bup.helpers.realpath(sys.stdin.readline())" \
         || return $?
 }
index e25f3f21d4f4c4ee7e62eff1eb0241442a7dd3d7..c61a1d25da4707d9acb249b3f5f4003860a94735 100755 (executable)
@@ -1,5 +1,6 @@
 #!/usr/bin/env bash
 . ./wvtest-bup.sh || exit $?
+. t/lib.sh || exit $?
 
 set -o pipefail
 
@@ -32,15 +33,16 @@ bup() { "$top/bup" "$@"; }
 savename()
 {
     readonly secs="$1"
-    WVPASS python -c "from time import strftime, localtime; \
+    WVPASS bup-python -c "from time import strftime, localtime; \
        print strftime('%Y-%m-%d-%H%M%S', localtime($secs))"
 }
 
 WVPASS bup init
 WVPASS cd "$tmpdir"
 
-savestamp1=$(WVPASS python -c 'import time; print int(time.time())') || exit $?
+savestamp1=$(WVPASS bup-python -c 'import time; print int(time.time())') || exit $?
 savestamp2=$(($savestamp1 + 1))
+
 savename1="$(savename "$savestamp1")" || exit $?
 savename2="$(savename "$savestamp2")" || exit $?
 
index 01c85963c5247263ab09e8c09029ea0b3e6d003a..4a1b2106df046479fd60a27f4ba6baf3ea9e7a61 100755 (executable)
@@ -1,5 +1,6 @@
 #!/usr/bin/env bash
 . ./wvtest-bup.sh || exit $?
+. t/lib.sh || exit $?
 
 set -o pipefail
 
@@ -137,7 +138,7 @@ symlink_date="$(WVPASS echo "$symlink_bup_info" \
     || exit $?
 
 if test "$(uname -s)" != NetBSD; then
-    symlink_size="$(WVPASS python -c "import os
+    symlink_size="$(WVPASS bup-python -c "import os
 print os.lstat('src/symlink').st_size")" || exit $?
 else
     # NetBSD appears to return varying sizes, so for now, just ignore it.
@@ -147,9 +148,9 @@ else
 fi
 
 uid="$(id -u)" || exit $?
-gid="$(python -c 'import os; print os.stat("src").st_gid')" || exit $?
+gid="$(bup-python -c 'import os; print os.stat("src").st_gid')" || exit $?
 user="$(id -un)" || exit $?
-group="$(python -c 'import grp, os;
+group="$(bup-python -c 'import grp, os;
 print grp.getgrgid(os.stat("src").st_gid)[0]')" || exit $?
 
 WVPASSEQ "$(bup ls -l src/latest"$tmpdir"/src | tr -s ' ' ' ')" \
index 2c886cce8b356e0963443d2caec753d0c4faa197..3f7f3a677f375a0355c7063968882252db7ed280 100755 (executable)
@@ -435,9 +435,9 @@ src/foo/3"
 
     tmpdir="$(WVPASS wvmktempdir)" || exit $?    
 
-    first_group="$(WVPASS python -c 'import os,grp; \
+    first_group="$(WVPASS bup-python -c 'import os,grp; \
       print grp.getgrgid(os.getgroups()[0])[0]')" || exit $?
-    last_group="$(python -c 'import os,grp; \
+    last_group="$(bup-python -c 'import os,grp; \
       print grp.getgrgid(os.getgroups()[-1])[0]')" || exit $?
     last_group_erx="$(escape-erx "$last_group")"
 
@@ -675,7 +675,7 @@ if [ "$root_status" = root ]; then
             WVPASS mkdir "$testfs"/src/foo
             WVPASS touch "$testfs"/src/bar
             PYTHONPATH="$TOP/lib" \
-                WVPASS python -c "from bup import xstat; \
+                WVPASS bup-python -c "from bup import xstat; \
                 x = xstat.timespec_to_nsecs((42, 0));\
                    xstat.utime('$testfs/src/foo', (x, x));\
                    xstat.utime('$testfs/src/bar', (x, x));"
@@ -716,7 +716,7 @@ if [ "$root_status" = root ]; then
                 WVPASS cd "$testfs_limited"/src-restore
                 WVFAIL bup meta --extract --file "$testfs"/src.meta 2>&1 \
                     | WVPASS grep -e '^Linux chattr:' \
-                    | WVPASS python -c \
+                    | WVPASS bup-python -c \
                     'import sys; exit(not len(sys.stdin.readlines()) == 3)'
             ) || exit $?
         ) || exit $?
@@ -740,7 +740,7 @@ if [ "$root_status" = root ]; then
             WVFAIL bup meta --extract --file "$testfs"/src.meta
             WVFAIL bup meta --extract --file "$testfs"/src.meta 2>&1 \
                 | WVPASS grep -e "^xattr\.set '" \
-                | WVPASS python -c \
+                | WVPASS bup-python -c \
                 'import sys; exit(not len(sys.stdin.readlines()) == 2)'
         ) || exit $?
 
@@ -762,7 +762,7 @@ if [ "$root_status" = root ]; then
             WVPASS cd "$testfs_limited"/src-restore
             WVFAIL bup meta --extract --file "$testfs"/src.meta 2>&1 \
                 | WVPASS grep -e '^POSIX1e ACL applyto:' \
-                | WVPASS python -c \
+                | WVPASS bup-python -c \
                 'import sys; exit(not len(sys.stdin.readlines()) == 2)'
         ) || exit $?
 
index e5eeee3756862f90deee5601a0dc6ca0450a2d57..f307826eeb48cd979ee7f8874c14fa37ef3fbb53 100755 (executable)
@@ -1,5 +1,6 @@
 #!/usr/bin/env bash
 . ./wvtest-bup.sh || exit $?
+. t/lib.sh || exit $?
 
 if [ $(t/root-status) != root ]; then
     echo 'Not root: skipping restore --map-* tests.'
@@ -79,7 +80,7 @@ WVPASS grep -qE "^uid: $other_uid\$" foo-xstat
 WVPASS grep -qE "^group: $other_group\$" foo-xstat
 WVPASS grep -qE "^gid: $other_gid\$" foo-xstat
 
-has_uid_gid_0=$(WVPASS python -c "
+has_uid_gid_0=$(WVPASS bup-python -c "
 import grp, pwd
 try:
   pwd.getpwuid(0)
index 82275ff8bc045f82e1f85b46f0f5b624740b2f59..8ce30339e539078f18becaeb6be3d730da492a64 100755 (executable)
@@ -18,7 +18,7 @@ WVPASS cd "$tmpdir"
 
 # The 3MB guess is semi-arbitrary, but we've been informed that
 # Lustre, for example, uses 1MB, so guess higher than that, at least.
-block_size=$(python -c \
+block_size=$(bup-python -c \
   "import os; print getattr(os.stat('.'), 'st_blksize', 0) or $mb * 3") \
     || exit $?
 data_size=$((block_size * 10))