diff options
Diffstat (limited to 'setuptools/_path.py')
| -rw-r--r-- | setuptools/_path.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/setuptools/_path.py b/setuptools/_path.py index 3767523b..b99d9dad 100644 --- a/setuptools/_path.py +++ b/setuptools/_path.py @@ -1,4 +1,5 @@ import os +import sys from typing import Union _Path = Union[str, os.PathLike] @@ -26,4 +27,11 @@ def same_path(p1: _Path, p2: _Path) -> bool: >>> same_path("a", "a/b") False """ - return os.path.normpath(p1) == os.path.normpath(p2) + return normpath(p1) == normpath(p2) + + +def normpath(filename: _Path) -> str: + """Normalize a file/dir name for comparison purposes.""" + # See pkg_resources.normalize_path for notes about cygwin + file = os.path.abspath(filename) if sys.platform == 'cygwin' else filename + return os.path.normcase(os.path.realpath(os.path.normpath(file))) |
