]> arthur.barton.de Git - bup.git/commitdiff
wvtest.py: drop relpath compatability code
authorRob Browning <rlb@defaultvalue.org>
Sat, 9 Nov 2019 19:36:16 +0000 (13:36 -0600)
committerRob Browning <rlb@defaultvalue.org>
Sun, 1 Dec 2019 18:20:23 +0000 (12:20 -0600)
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
LICENSE
wvtest.py

diff --git a/LICENSE b/LICENSE
index 6ed12e5c88ad35cb740abd8e1fb8640a88b6685c..ed0a3777699f01df6561eacefaad50781cdc6976 100644 (file)
--- a/LICENSE
+++ b/LICENSE
@@ -7,10 +7,6 @@ In addition, bupsplit.c, bupsplit.h, and options.py may be
 redistributed according to the separate (BSD-style) license written
 inside those files.
 
-The definition of the relpath function was taken from CPython (tag
-v2.6, file Lib/posixpath.py, hg-commit 95fff5a6a276) and is covered
-under the terms of the PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2.
-
 
                   GNU LIBRARY GENERAL PUBLIC LICENSE
                        Version 2, June 1991
index 90781275b7e018e488ab2cf10ca60fbb295cc14e..6a302d7bae697fa87be99c03f409d9869cfda9df 100755 (executable)
--- a/wvtest.py
+++ b/wvtest.py
@@ -14,6 +14,7 @@ exec "$bup_python" "$0" ${1+"$@"}
 #
 
 from __future__ import absolute_import, print_function
+from os.path import relpath
 import atexit
 import inspect
 import os
@@ -193,33 +194,11 @@ def _run_in_chdir(path, func, *args, **kwargs):
         sys.path = oldpath
 
 
-if sys.version_info >= (2,6,0):
-    _relpath = os.path.relpath;
-else:
-    # Implementation for Python 2.5, taken from CPython (tag v2.6,
-    # file Lib/posixpath.py, hg-commit 95fff5a6a276).  Update
-    # ./LICENSE When this code is eventually removed.
-    def _relpath(path, start=os.path.curdir):
-        if not path:
-            raise ValueError("no path specified")
-
-        start_list = os.path.abspath(start).split(os.path.sep)
-        path_list = os.path.abspath(path).split(os.path.sep)
-
-        # Work out how much of the filepath is shared by start and path.
-        i = len(os.path.commonprefix([start_list, path_list]))
-
-        rel_list = [os.path.pardir] * (len(start_list)-i) + path_list[i:]
-        if not rel_list:
-            return curdir
-        return os.path.join(*rel_list)
-
-
 def _runtest(fname, f):
     mod = inspect.getmodule(f)
-    relpath = _relpath(mod.__file__, os.getcwd()).replace('.pyc', '.py')
+    rpath = relpath(mod.__file__, os.getcwd()).replace('.pyc', '.py')
     print()
-    print('Testing "%s" in %s:' % (fname, relpath))
+    print('Testing "%s" in %s:' % (fname, rpath))
     sys.stdout.flush()
     try:
         _run_in_chdir(os.path.split(mod.__file__)[0], f)