1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

Use the real path of sys.prefix

This commit is contained in:
Jannis Leidel 2009-07-02 00:34:24 +02:00
parent 9e113755f0
commit 6db22f978e

8
pip.py
View file

@ -4138,8 +4138,9 @@ def package_to_requirement(package_name):
def strip_sys_prefix(path):
""" If ``path`` begins with sys.prefix, return ``path`` with
sys.prefix stripped off. Otherwise return None."""
if path.startswith(sys.prefix):
return path.replace(sys.prefix, '')
sys_prefix = os.path.realpath(sys.prefix)
if path.startswith(sys_prefix):
return path.replace(sys_prefix, '')
return None
def remove_entries_from_file(filename, entries, auto_confirm=True):
@ -4178,8 +4179,7 @@ def remove_entries_from_file(filename, entries, auto_confirm=True):
def remove_paths(paths, auto_confirm=False):
"""Remove paths in iterable ``paths`` with confirmation
(unless ``auto_confirm`` is True)."""
logger.notify('Within environment %s, removing:' % sys.prefix)
logger.notify('Within environment %s, removing:' % os.path.realpath(sys.prefix))
logger.indent += 2
try:
if auto_confirm: