Merge pull request #3843 from pypa/resolve-symlink

Make sure symlinks are resolved.
This commit is contained in:
Frost Ming
2019-07-13 23:28:36 +08:00
committed by GitHub
2 changed files with 5 additions and 5 deletions
+1
View File
@@ -0,0 +1 @@
Resolve the symlinks when the path is absolute.
+4 -5
View File
@@ -47,11 +47,10 @@ def _normalized(p):
if p is None:
return None
loc = vistir.compat.Path(p)
if not loc.is_absolute():
try:
loc = loc.resolve()
except OSError:
loc = loc.absolute()
try:
loc = loc.resolve()
except OSError:
loc = loc.absolute()
# Recase the path properly on Windows. From https://stackoverflow.com/a/35229734/5043728
if os.name == 'nt':
matches = glob.glob(re.sub(r'([^:/\\])(?=[/\\]|$)', r'[\1]', str(loc)))