-The files in this project may all be distributed under the terms of the
-following license. (The LGPL version 2.)
+Unless otherwise stated below, the files in this project may be
+distributed under the terms of the following license. (The LGPL
+version 2.)
In addition, bupsplit.c, bupsplit.h, and options.py may be
-redistributed according to the separate license (a BSD-style license)
-written inside those files.
+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
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 = os.path.relpath(mod.__file__, os.getcwd()).replace('.pyc', '.py')
+ relpath = _relpath(mod.__file__, os.getcwd()).replace('.pyc', '.py')
print
print 'Testing "%s" in %s:' % (fname, relpath)
sys.stdout.flush()