diff options
-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 """ |