@@ -423,7 +423,7 @@ def commit(self) -> None:
423
423
def from_dist (cls , dist : BaseDistribution ) -> "UninstallPathSet" :
424
424
dist_location = dist .location
425
425
info_location = dist .info_location
426
- if dist_location is None or info_location is None :
426
+ if dist_location is None :
427
427
logger .info (
428
428
"Not uninstalling %s since it is not installed" ,
429
429
dist .canonical_name ,
@@ -457,10 +457,11 @@ def from_dist(cls, dist: BaseDistribution) -> "UninstallPathSet":
457
457
458
458
# Uninstall cases order do matter as in the case of 2 installs of the
459
459
# same package, pip needs to uninstall the currently detected version
460
- if dist .installed_with_egg_info and not dist .editable :
460
+ if dist .installed_with_setuptools_egg_info and not dist .editable :
461
461
# if dist is editable and the location points to a ``.egg-info``,
462
462
# we are in fact in the ``.egg_link`` case.
463
- paths_to_remove .add (info_location )
463
+ if info_location is not None :
464
+ paths_to_remove .add (info_location )
464
465
installed_files = dist .iter_declared_entries ()
465
466
if installed_files is not None :
466
467
for installed_file in installed_files :
@@ -486,7 +487,7 @@ def from_dist(cls, dist: BaseDistribution) -> "UninstallPathSet":
486
487
paths_to_remove .add (f"{ path } .pyc" )
487
488
paths_to_remove .add (f"{ path } .pyo" )
488
489
489
- elif dist .installed_by_legacy_distutils :
490
+ elif dist .installed_by_distutils :
490
491
raise UninstallationError (
491
492
"Cannot uninstall {!r}. It is a distutils installed project "
492
493
"and thus we cannot accurately determine which files belong "
0 commit comments