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:58:44 +0000 |
commit | b4455d8c612df975c3f279486a29f6b5572e7f8c (patch) | |
tree | 1e1aec023b311bb4049e78f652d7bf6c5555180f /meta/lib/oe | |
parent | eb1e41e68fe60001a727549405d4a489a3e392c0 (diff) | |
download | poky-b4455d8c612df975c3f279486a29f6b5572e7f8c.tar.gz |
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.
(From OE-Core rev: 1a03cd16401d2926bba902ffc5df30911b5c9394)
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe')
-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): | |||
21 | foo/bar | 21 | foo/bar |
22 | """ | 22 | """ |
23 | 23 | ||
24 | if hasattr(os.path, "relpath"): | 24 | return os.path.relpath(dest, src) |
25 | return os.path.relpath(dest, src) | ||
26 | else: | ||
27 | destlist = os.path.normpath(dest).split(os.path.sep) | ||
28 | srclist = os.path.normpath(src).split(os.path.sep) | ||
29 | |||
30 | # Find common section of the path | ||
31 | common = os.path.commonprefix([destlist, srclist]) | ||
32 | commonlen = len(common) | ||
33 | |||
34 | # Climb back to the point where they differentiate | ||
35 | relpath = [ os.path.pardir ] * (len(srclist) - commonlen) | ||
36 | if commonlen < len(destlist): | ||
37 | # Add remaining portion | ||
38 | relpath += destlist[commonlen:] | ||
39 | |||
40 | return os.path.sep.join(relpath) | ||
41 | 25 | ||
42 | def make_relative_symlink(path): | 26 | def make_relative_symlink(path): |
43 | """ Convert an absolute symlink to a relative one """ | 27 | """ Convert an absolute symlink to a relative one """ |