updated code

This commit is contained in:
darshanip 2022-11-03 18:46:31 +05:30
parent 0dc566f06b
commit b0a5b037ff
3 changed files with 6 additions and 7 deletions

View File

@ -94,19 +94,15 @@ class UninstallCommand(Command, SessionCommandMixin):
modifying_pip="pip" in reqs_to_uninstall
)
everything_okay = True
for req in reqs_to_uninstall.values():
uninstall_pathset = req.uninstall(
auto_confirm=options.yes,
verbose=self.verbosity > 0,
)
if uninstall_pathset:
if req.files_skipped:
return ERROR
uninstall_pathset.commit()
else:
everything_okay = False
if options.root_user_action == "warn":
warn_if_run_as_root()
if everything_okay:
return SUCCESS
else:
return ERROR
return SUCCESS

View File

@ -658,6 +658,7 @@ class InstallRequirement:
uninstalled_pathset = UninstallPathSet.from_dist(dist)
uninstalled_pathset.remove(auto_confirm, verbose)
self.files_skipped = uninstalled_pathset.files_skipped
return uninstalled_pathset
def _get_archive_name(self, path: str, parentdir: str, rootdir: str) -> str:

View File

@ -352,12 +352,14 @@ class UninstallPathSet:
def remove(self, auto_confirm: bool = False, verbose: bool = False) -> None:
"""Remove paths in ``self._paths`` with confirmation (unless
``auto_confirm`` is True)."""
self.files_skipped = False
if not self._paths:
logger.info(
"Can't uninstall '%s'. No files were found to uninstall.",
self._dist.raw_name,
)
self.files_skipped = True
return
dist_name_version = f"{self._dist.raw_name}-{self._dist.version}"