Skip to content

Commit 23b03de

Browse files
committed
Use the built in support for os.path.samefile
1 parent 28d4954 commit 23b03de

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

pip/compat.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
__all__ = [
2222
"ipaddress", "uses_pycache", "console_to_str", "native_str",
23-
"get_path_uid", "stdlib_pkgs", "WINDOWS", "samefile",
23+
"get_path_uid", "stdlib_pkgs", "WINDOWS",
2424
]
2525

2626

@@ -111,13 +111,3 @@ def expanduser(path):
111111
# windows detection, covers cpython and ironpython
112112
WINDOWS = (sys.platform.startswith("win") or
113113
(sys.platform == 'cli' and os.name == 'nt'))
114-
115-
116-
def samefile(file1, file2):
117-
"""Provide an alternative for os.path.samefile on Windows/Python2"""
118-
if hasattr(os.path, 'samefile'):
119-
return os.path.samefile(file1, file2)
120-
else:
121-
path1 = os.path.normcase(os.path.abspath(file1))
122-
path2 = os.path.normcase(os.path.abspath(file2))
123-
return path1 == path2

pip/vcs/git.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import tempfile
55
import os.path
66

7-
from pip.compat import samefile
87
from pip.exceptions import BadCommand
98
from pip._vendor.six.moves.urllib import parse as urllib_parse
109
from pip._vendor.six.moves.urllib import request as urllib_request
@@ -238,7 +237,7 @@ def _get_subdirectory(self, location):
238237
)
239238
return None
240239
# relative path of setup.py to repo root
241-
if samefile(root_dir, location):
240+
if os.path.samefile(root_dir, location):
242241
return None
243242
return os.path.relpath(location, root_dir)
244243

0 commit comments

Comments
 (0)