]> arthur.barton.de Git - bup.git/commitdiff
txstat: fix for python 3
authorRob Browning <rlb@defaultvalue.org>
Thu, 10 Oct 2019 04:21:04 +0000 (23:21 -0500)
committerRob Browning <rlb@defaultvalue.org>
Sun, 13 Oct 2019 17:41:16 +0000 (12:41 -0500)
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Makefile
buptest.py
lib/bup/_helpers.c
lib/bup/t/thelpers.py
lib/bup/t/txstat.py

index f4d999bae21bd350b0187ca5f596363c067a7a19..a8ad4a29c1944d417591dcb75a08039ec27ac140 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -163,7 +163,8 @@ else
     lib/bup/t/thashsplit.py \
     lib/bup/t/toptions.py \
     lib/bup/t/tshquote.py \
     lib/bup/t/thashsplit.py \
     lib/bup/t/toptions.py \
     lib/bup/t/tshquote.py \
-    lib/bup/t/tvint.py
+    lib/bup/t/tvint.py \
+    lib/bup/t/txstat.py
 endif
 
 # The "pwd -P" here may not be appropriate in the long run, but we
 endif
 
 # The "pwd -P" here may not be appropriate in the long run, but we
index 22523b70334f5dd7eb2aa380493e47fa7211c083..a50387212c5a8a68dbcc992d6db8079aa9cd3c42 100644 (file)
@@ -33,7 +33,7 @@ def no_lingering_errors():
 
 
 # Assumes (of course) this file is at the top-level of the source tree
 
 
 # Assumes (of course) this file is at the top-level of the source tree
-_bup_tmp = realpath(dirname(__file__) + '/t/tmp')
+_bup_tmp = realpath(dirname(__file__.encode('iso-8859-1')) + b'/t/tmp')
 try:
     os.makedirs(_bup_tmp)
 except OSError as e:
 try:
     os.makedirs(_bup_tmp)
 except OSError as e:
index 592c1217d077ad3c9e5ae68b6ea517927c485a84..9078be3da723d8e7757662950a7521bdc275754f 100644 (file)
@@ -1250,7 +1250,7 @@ static PyObject *bup_utimensat(PyObject *self, PyObject *args)
     PyObject *access_py, *modification_py;
     struct timespec ts[2];
 
     PyObject *access_py, *modification_py;
     struct timespec ts[2];
 
-    if (!PyArg_ParseTuple(args, "is((Ol)(Ol))i",
+    if (!PyArg_ParseTuple(args, "i" cstr_argf "((Ol)(Ol))i",
                           &fd,
                           &path,
                           &access_py, &(ts[0].tv_nsec),
                           &fd,
                           &path,
                           &access_py, &(ts[0].tv_nsec),
@@ -1292,7 +1292,7 @@ static int bup_parse_xutimes_args(char **path,
     PyObject *access_py, *modification_py;
     long long access_us, modification_us; // POSIX guarantees tv_usec is signed.
 
     PyObject *access_py, *modification_py;
     long long access_us, modification_us; // POSIX guarantees tv_usec is signed.
 
-    if (!PyArg_ParseTuple(args, "s((OL)(OL))",
+    if (!PyArg_ParseTuple(args, cstr_argf "((OL)(OL))",
                           path,
                           &access_py, &access_us,
                           &modification_py, &modification_us))
                           path,
                           &access_py, &access_us,
                           &modification_py, &modification_us))
index d9f470480f142d5ec10e33a22b34e4ed936fcaa6..501e8beb6d3f570c43f90e33c18f1c868f46c5af 100644 (file)
@@ -143,8 +143,8 @@ def test_batchpipe():
 @wvtest
 def test_atomically_replaced_file():
     with no_lingering_errors():
 @wvtest
 def test_atomically_replaced_file():
     with no_lingering_errors():
-        with test_tempdir('bup-thelper-') as tmpdir:
-            target_file = os.path.join(tmpdir, 'test-atomic-write')
+        with test_tempdir(b'bup-thelper-') as tmpdir:
+            target_file = os.path.join(tmpdir, b'test-atomic-write')
 
             with atomically_replaced_file(target_file, mode='w') as f:
                 f.write('asdf')
 
             with atomically_replaced_file(target_file, mode='w') as f:
                 f.write('asdf')
index 64bad2de0eed71d0e8776dabe1831e5e1e9d3247..d002a36db3ad17ee9fb2fef5b380466041ef1dc1 100644 (file)
@@ -65,10 +65,10 @@ def test_bup_utimensat():
     if not xstat._bup_utimensat:
         return
     with no_lingering_errors():
     if not xstat._bup_utimensat:
         return
     with no_lingering_errors():
-        with test_tempdir('bup-txstat-') as tmpdir:
-            path = tmpdir + '/foo'
+        with test_tempdir(b'bup-txstat-') as tmpdir:
+            path = tmpdir + b'/foo'
             open(path, 'w').close()
             open(path, 'w').close()
-            frac_ts = (0, 10**9 / 2)
+            frac_ts = (0, 10**9 // 2)
             xstat._bup_utimensat(_helpers.AT_FDCWD, path, (frac_ts, frac_ts), 0)
             st = _helpers.stat(path)
             atime_ts = st[8]
             xstat._bup_utimensat(_helpers.AT_FDCWD, path, (frac_ts, frac_ts), 0)
             st = _helpers.stat(path)
             atime_ts = st[8]
@@ -84,10 +84,10 @@ def test_bup_utimes():
     if not xstat._bup_utimes:
         return
     with no_lingering_errors():
     if not xstat._bup_utimes:
         return
     with no_lingering_errors():
-        with test_tempdir('bup-txstat-') as tmpdir:
-            path = tmpdir + '/foo'
+        with test_tempdir(b'bup-txstat-') as tmpdir:
+            path = tmpdir + b'/foo'
             open(path, 'w').close()
             open(path, 'w').close()
-            frac_ts = (0, 10**6 / 2)
+            frac_ts = (0, 10**6 // 2)
             xstat._bup_utimes(path, (frac_ts, frac_ts))
             st = _helpers.stat(path)
             atime_ts = st[8]
             xstat._bup_utimes(path, (frac_ts, frac_ts))
             st = _helpers.stat(path)
             atime_ts = st[8]
@@ -103,10 +103,10 @@ def test_bup_lutimes():
     if not xstat._bup_lutimes:
         return
     with no_lingering_errors():
     if not xstat._bup_lutimes:
         return
     with no_lingering_errors():
-        with test_tempdir('bup-txstat-') as tmpdir:
-            path = tmpdir + '/foo'
+        with test_tempdir(b'bup-txstat-') as tmpdir:
+            path = tmpdir + b'/foo'
             open(path, 'w').close()
             open(path, 'w').close()
-            frac_ts = (0, 10**6 / 2)
+            frac_ts = (0, 10**6 // 2)
             xstat._bup_lutimes(path, (frac_ts, frac_ts))
             st = _helpers.stat(path)
             atime_ts = st[8]
             xstat._bup_lutimes(path, (frac_ts, frac_ts))
             st = _helpers.stat(path)
             atime_ts = st[8]