Skip to content
This repository has been archived by the owner on Aug 20, 2018. It is now read-only.

Commit

Permalink
Bug 886000 - remove pre-python 2.6 ManifestDestiny hack for relpath;r…
Browse files Browse the repository at this point in the history
…=ahal
  • Loading branch information
Jeff Hammel committed Jul 2, 2013
1 parent 52bb69c commit ff38d59
Showing 1 changed file with 1 addition and 24 deletions.
25 changes: 1 addition & 24 deletions manifestdestiny/manifestparser/manifestparser.py
Expand Up @@ -19,30 +19,7 @@
from fnmatch import fnmatch
from optparse import OptionParser

# we need relpath, but it is introduced in python 2.6
# http://docs.python.org/library/os.path.html
try:
relpath = os.path.relpath
except AttributeError:
def relpath(path, start):
"""
Return a relative version of a path
from /usr/lib/python2.6/posixpath.py
"""

if not path:
raise ValueError("no path specified")

start_list = os.path.abspath(start).split(os.path.sep)
path_list = os.path.abspath(path).split(os.path.sep)

# Work out how much of the filepath is shared by start and path.
i = len(os.path.commonprefix([start_list, path_list]))

rel_list = [os.path.pardir] * (len(start_list)-i) + path_list[i:]
if not rel_list:
return os.curdir
return os.path.join(*rel_list)
relpath = os.path.relpath

# expr.py
# from:
Expand Down

0 comments on commit ff38d59

Please sign in to comment.