[oe-commits] Ross Burton : lib/oe: drop custom implementation of oe.path.relative
git at git.openembedded.org
git at git.openembedded.org
Fri Mar 7 14:40:00 UTC 2014
Module: openembedded-core.git
Branch: master-next
Commit: d53d747468df0532a5ee21c6747560f44500eef4
URL: http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=d53d747468df0532a5ee21c6747560f44500eef4
Author: Ross Burton <ross.burton at intel.com>
Date: Mon Mar 3 20:26:19 2014 +0000
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 at intel.com>
Signed-off-by: Saul Wold <sgw at linux.intel.com>
---
meta/lib/oe/path.py | 18 +-----------------
1 file changed, 1 insertion(+), 17 deletions(-)
diff --git a/meta/lib/oe/path.py b/meta/lib/oe/path.py
index 46783f8..413ebfb 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 """
More information about the Openembedded-commits
mailing list