mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
Don't fail uninstallation if easy-install.pth doesn't exist
This commit is contained in:
parent
8c95de11cc
commit
4264d5e0d3
2 changed files with 8 additions and 5 deletions
0
news/7856.bugfix
Normal file
0
news/7856.bugfix
Normal file
|
@ -585,11 +585,6 @@ class UninstallPathSet(object):
|
||||||
class UninstallPthEntries(object):
|
class UninstallPthEntries(object):
|
||||||
def __init__(self, pth_file):
|
def __init__(self, pth_file):
|
||||||
# type: (str) -> None
|
# type: (str) -> None
|
||||||
if not os.path.isfile(pth_file):
|
|
||||||
raise UninstallationError(
|
|
||||||
"Cannot remove entries from nonexistent file {}".format(
|
|
||||||
pth_file)
|
|
||||||
)
|
|
||||||
self.file = pth_file
|
self.file = pth_file
|
||||||
self.entries = set() # type: Set[str]
|
self.entries = set() # type: Set[str]
|
||||||
self._saved_lines = None # type: Optional[List[bytes]]
|
self._saved_lines = None # type: Optional[List[bytes]]
|
||||||
|
@ -613,6 +608,14 @@ class UninstallPthEntries(object):
|
||||||
def remove(self):
|
def remove(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
logger.debug('Removing pth entries from %s:', self.file)
|
logger.debug('Removing pth entries from %s:', self.file)
|
||||||
|
|
||||||
|
# If the file doesn't exist, log a warning and return
|
||||||
|
if not os.path.isfile(self.file):
|
||||||
|
logger.warning(
|
||||||
|
"Cannot remove entries from nonexistent file {}".format(
|
||||||
|
self.file)
|
||||||
|
)
|
||||||
|
return
|
||||||
with open(self.file, 'rb') as fh:
|
with open(self.file, 'rb') as fh:
|
||||||
# windows uses '\r\n' with py3k, but uses '\n' with py2.x
|
# windows uses '\r\n' with py3k, but uses '\n' with py2.x
|
||||||
lines = fh.readlines()
|
lines = fh.readlines()
|
||||||
|
|
Loading…
Reference in a new issue