]> code.ossystems Code Review - openembedded-core.git/commitdiff
lib/oe: drop custom implementation of oe.path.relative
authorRoss Burton <ross.burton@intel.com>
Mon, 3 Mar 2014 20:26:19 +0000 (20:26 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 7 Mar 2014 14:55:26 +0000 (14:55 +0000)
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>
meta/lib/oe/path.py

index 46783f86684f2653a1b2bf17ff398fa7dc7aaa4a..413ebfb395c24cf6d0ab91a0ec9567d75a881173 100644 (file)
@@ -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 """