aboutsummaryrefslogtreecommitdiffstats
path: root/pkg_resources
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2018-10-25 20:32:10 -0400
committerGitHub <noreply@github.com>2018-10-25 20:32:10 -0400
commit778424816279c892be3f7b0b7e48f7195f4348ad (patch)
tree602e7adc99847c429a92806a7f4ffd2b14ed3206 /pkg_resources
parentd765ecb15daa2145bb87de5fcc6ed45d371e2330 (diff)
parentd0b88ac944944580a1ff52e0a3fda9fdbc7fb095 (diff)
downloadexternal_python_setuptools-778424816279c892be3f7b0b7e48f7195f4348ad.tar.gz
external_python_setuptools-778424816279c892be3f7b0b7e48f7195f4348ad.tar.bz2
external_python_setuptools-778424816279c892be3f7b0b7e48f7195f4348ad.zip
Merge branch 'master' into normalize-path-normpath
Diffstat (limited to 'pkg_resources')
-rw-r--r--pkg_resources/__init__.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py
index 2b2442f5..cddb21fb 100644
--- a/pkg_resources/__init__.py
+++ b/pkg_resources/__init__.py
@@ -2228,7 +2228,18 @@ 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.normpath(os.path.realpath(filename)))
+ return os.path.normcase(os.path.realpath(os.path.normpath(_cygwin_patch(filename))))
+
+
+def _cygwin_patch(filename): # pragma: nocover
+ """
+ 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.abspath(filename) if sys.platform == 'cygwin' else filename
def _normalize_cached(filename, _cache={}):