summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Blevins <wblevins001@gmail.com>2015-10-01 12:37:41 (GMT)
committerWilliam Blevins <wblevins001@gmail.com>2015-10-01 12:37:41 (GMT)
commit4bac666bb4f85f0efe0b4002a527c9f4b510c306 (patch)
tree925f773367349ffb7b60c98769f276d22be4b301
parent94c7bf6f844758f8f9a3b993bae88e91fc1fe452 (diff)
downloadSCons-4bac666bb4f85f0efe0b4002a527c9f4b510c306.zip
SCons-4bac666bb4f85f0efe0b4002a527c9f4b510c306.tar.gz
SCons-4bac666bb4f85f0efe0b4002a527c9f4b510c306.tar.bz2
Code cleanup: removed function for supporting relpath in pre-2.6 python.
-rw-r--r--src/engine/SCons/Tool/GettextCommon.py19
1 files changed, 1 insertions, 18 deletions
diff --git a/src/engine/SCons/Tool/GettextCommon.py b/src/engine/SCons/Tool/GettextCommon.py
index cd2f306..bdd52c0 100644
--- a/src/engine/SCons/Tool/GettextCommon.py
+++ b/src/engine/SCons/Tool/GettextCommon.py
@@ -306,23 +306,6 @@ class RPaths(object):
- Tuple of strings, which represent paths relative to current working
directory (for given environment).
"""
- # os.path.relpath is available only on python >= 2.6. We use our own
- # implementation. It's taken from BareNecessities package:
- # http://jimmyg.org/work/code/barenecessities/index.html
- from posixpath import curdir
- def relpath(path, start=curdir):
- import posixpath
- """Return a relative version of a path"""
- if not path:
- raise ValueError("no path specified")
- start_list = posixpath.abspath(start).split(posixpath.sep)
- path_list = posixpath.abspath(path).split(posixpath.sep)
- # Work out how much of the filepath is shared by start and path.
- i = len(posixpath.commonprefix([start_list, path_list]))
- rel_list = [posixpath.pardir] * (len(start_list)-i) + path_list[i:]
- if not rel_list:
- return posixpath.curdir
- return posixpath.join(*rel_list)
import os
import SCons.Node.FS
rpaths = ()
@@ -330,7 +313,7 @@ class RPaths(object):
for node in nodes:
rpath = None
if isinstance(node, SCons.Node.FS.Base):
- rpath = relpath(node.get_abspath(), cwd)
+ rpath = os.path.relpath(node.get_abspath(), cwd)
# FIXME: Other types possible here?
if rpath is not None:
rpaths += (rpath,)