aboutsummaryrefslogtreecommitdiffstats
path: root/pkg_resources/__init__.py
diff options
context:
space:
mode:
authorMichael Wild <themiwi@users.sourceforge.net>2018-04-22 13:07:52 +0200
committerGitHub <noreply@github.com>2018-04-22 13:07:52 +0200
commit9af3f4208386064dbe5c7f5c9b6724a8bb1e760c (patch)
tree713d1c583c24a334b2444852e842ff2654e36bd8 /pkg_resources/__init__.py
parentaf4e065b58789fd67fdbc897af981b670f01099b (diff)
downloadexternal_python_setuptools-9af3f4208386064dbe5c7f5c9b6724a8bb1e760c.tar.gz
external_python_setuptools-9af3f4208386064dbe5c7f5c9b6724a8bb1e760c.tar.bz2
external_python_setuptools-9af3f4208386064dbe5c7f5c9b6724a8bb1e760c.zip
Adds call to os.path.abspath() in pkg_resources.normalize_path() on Cygwin
This works around problems that stem from getcwd(3) on Cygwin returning paths containing symlinks. I am not sure at all whether this is a good place to fix it, but that's where I got hit by the issue when doing a `python setup.py develop` (or `pip install -e .`).
Diffstat (limited to 'pkg_resources/__init__.py')
-rw-r--r--pkg_resources/__init__.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py
index 8d95bd29..3cbb5d19 100644
--- a/pkg_resources/__init__.py
+++ b/pkg_resources/__init__.py
@@ -2220,7 +2220,15 @@ register_namespace_handler(object, null_ns_handler)
def normalize_path(filename):
"""Normalize a file/dir name for comparison purposes"""
- return os.path.normcase(os.path.realpath(filename))
+ if sys.platform == 'cygwin':
+ # This results in a call to getcwd() if `filename` is relative. Contrary
+ # to POSIX 2008 on Cygwin getcwd (3) contains symlink components. Using
+ # os.path.abspath() works around this limitation. A fix in os.getcwd()
+ # would probably better, in Cygwin even more so except that this seems
+ # to be by design...
+ return os.path.normcase(os.path.realpath(os.path.abspath(filename)))
+ else:
+ return os.path.normcase(os.path.realpath(filename))
def _normalize_cached(filename, _cache={}):