Have importlib look for pre-existing path separators when joining

paths.
This commit is contained in:
Brett Cannon 2012-04-21 21:21:27 -04:00
parent cb165db3a3
commit 0d05a7698b
2 changed files with 3023 additions and 3011 deletions

View File

@ -63,8 +63,16 @@ def _r_long(int_bytes):
def _path_join(*args):
"""Replacement for os.path.join()."""
sep = path_sep if args[0][-1:] not in path_separators else args[0][-1]
return sep.join(x[:-len(path_sep)] if x.endswith(path_sep) else x
if len(path_separators) == 1:
sep = path_sep
else:
for c in reversed(args[0]):
if x in path_separators:
sep = x
break
else:
sep = path_sep
return sep.join(x[:-len(sep)] if x.endswith(sep) else x
for x in args if x)

File diff suppressed because it is too large Load Diff