--- a/PluginPipxInterface.py Sat Jul 27 17:39:00 2024 +0200 +++ b/PluginPipxInterface.py Sat Jul 27 19:39:32 2024 +0200 @@ -7,6 +7,7 @@ Module implementing the pipx Interface plug-in. """ +import importlib.util import os import sysconfig @@ -148,6 +149,8 @@ self.__ui = ui self.__initialize() + # TODO: add option to check outdated dependencies when checking for + # outdated status self.__defaults = { "RecentAppWorkdirs": [], "MaxRecentAppWorkdirs": 20, @@ -303,10 +306,14 @@ @param pipInstall function to be called with a list of package names. @type function """ - try: - import pipx # __IGNORE_WARNING__ - except ImportError: - pipInstall(["pipx>=1.5.0"]) + packagesToInstall = [] + if importlib.util.find_spec("pipx") is None: + packagesToInstall.append("pipx>=1.5.0") + if importlib.util.find_spec("psutil") is None: + packagesToInstall.append("psutil") + + if packagesToInstall: + pipInstall(packagesToInstall) #