diff options
author | Ross Burton <ross.burton@intel.com> | 2014-03-03 20:26:19 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-03-07 14:55:26 +0000 |
commit | 1a03cd16401d2926bba902ffc5df30911b5c9394 (patch) | |
tree | 2191caf83a4ca7c43354f756a35d62952834dace | |
parent | fc14983ae62dc4eb9f08e8f172ac51faaa6bcae2 (diff) | |
download | openembedded-core-1a03cd16401d2926bba902ffc5df30911b5c9394.tar.gz openembedded-core-1a03cd16401d2926bba902ffc5df30911b5c9394.tar.bz2 openembedded-core-1a03cd16401d2926bba902ffc5df30911b5c9394.zip |
lib/oe: drop custom implementation of oe.path.relative
As we now require Python 2.7 and os.path.relpath() was added in 2.6 we can now
drop the reimplementation in oe.path.
oe.path.relative is simple now a wrapper that changes the order of the arguments
and it's use discouraged.
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
-rw-r--r-- | meta/lib/oe/path.py | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/meta/lib/oe/path.py b/meta/lib/oe/path.py index 46783f8668..413ebfb395 100644 --- a/meta/lib/oe/path.py +++ b/meta/lib/oe/path.py @@ -21,23 +21,7 @@ def relative(src, dest): foo/bar """ - if hasattr(os.path, "relpath"): - return os.path.relpath(dest, src) - else: - destlist = os.path.normpath(dest).split(os.path.sep) - srclist = os.path.normpath(src).split(os.path.sep) - - # Find common section of the path - common = os.path.commonprefix([destlist, srclist]) - commonlen = len(common) - - # Climb back to the point where they differentiate - relpath = [ os.path.pardir ] * (len(srclist) - commonlen) - if commonlen < len(destlist): - # Add remaining portion - relpath += destlist[commonlen:] - - return os.path.sep.join(relpath) + return os.path.relpath(dest, src) def make_relative_symlink(path): """ Convert an absolute symlink to a relative one """ |