mirror of https://github.com/pypa/pip
Revert "Use the built in support for os.path.samefile"
This reverts commit 23b03de81a
.
This commit is contained in:
parent
0992a81d3e
commit
0eae0299a1
|
@ -20,7 +20,7 @@ except ImportError:
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"ipaddress", "uses_pycache", "console_to_str", "native_str",
|
"ipaddress", "uses_pycache", "console_to_str", "native_str",
|
||||||
"get_path_uid", "stdlib_pkgs", "WINDOWS",
|
"get_path_uid", "stdlib_pkgs", "WINDOWS", "samefile",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -111,3 +111,13 @@ stdlib_pkgs = {"python", "wsgiref", "argparse"}
|
||||||
# windows detection, covers cpython and ironpython
|
# windows detection, covers cpython and ironpython
|
||||||
WINDOWS = (sys.platform.startswith("win") or
|
WINDOWS = (sys.platform.startswith("win") or
|
||||||
(sys.platform == 'cli' and os.name == 'nt'))
|
(sys.platform == 'cli' and os.name == 'nt'))
|
||||||
|
|
||||||
|
|
||||||
|
def samefile(file1, file2):
|
||||||
|
"""Provide an alternative for os.path.samefile on Windows/Python2"""
|
||||||
|
if hasattr(os.path, 'samefile'):
|
||||||
|
return os.path.samefile(file1, file2)
|
||||||
|
else:
|
||||||
|
path1 = os.path.normcase(os.path.abspath(file1))
|
||||||
|
path2 = os.path.normcase(os.path.abspath(file2))
|
||||||
|
return path1 == path2
|
||||||
|
|
|
@ -4,6 +4,7 @@ import logging
|
||||||
import tempfile
|
import tempfile
|
||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
|
from pip.compat import samefile
|
||||||
from pip.exceptions import BadCommand
|
from pip.exceptions import BadCommand
|
||||||
from pip._vendor.six.moves.urllib import parse as urllib_parse
|
from pip._vendor.six.moves.urllib import parse as urllib_parse
|
||||||
from pip._vendor.six.moves.urllib import request as urllib_request
|
from pip._vendor.six.moves.urllib import request as urllib_request
|
||||||
|
@ -237,7 +238,7 @@ class Git(VersionControl):
|
||||||
)
|
)
|
||||||
return None
|
return None
|
||||||
# relative path of setup.py to repo root
|
# relative path of setup.py to repo root
|
||||||
if os.path.samefile(root_dir, location):
|
if samefile(root_dir, location):
|
||||||
return None
|
return None
|
||||||
return os.path.relpath(location, root_dir)
|
return os.path.relpath(location, root_dir)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue