--- a/src/eric7/PipInterface/Pip.py Sun Jun 02 09:51:47 2024 +0200 +++ b/src/eric7/PipInterface/Pip.py Wed Jul 03 09:20:41 2024 +0200 @@ -245,22 +245,35 @@ return interpreter - def getVirtualenvNames(self, noRemote=False, noConda=False): + def getVirtualenvNames( + self, noRemote=False, noConda=False, noGlobals=False, noServer=False + ): """ Public method to get a sorted list of virtual environment names. @param noRemote flag indicating to exclude environments for remote - debugging - @type bool - @param noConda flag indicating to exclude Conda environments - @type bool + debugging (defaults to False) + @type bool (optional) + @param noConda flag indicating to exclude Conda environments (defaults to False) + @type bool (optional) + @param noGlobals flag indicating to exclude global environments + (defaults to False) + @type bool (optional) + @param noServer flag indicating to exclued eric-ide server environments + (defaults to False) + @type bool (optional) @return sorted list of virtual environment names @rtype list of str """ return sorted( ericApp() .getObject("VirtualEnvManager") - .getVirtualenvNames(noRemote=noRemote, noConda=noConda) + .getVirtualenvNames( + noRemote=noRemote, + noConda=noConda, + noGlobals=noGlobals, + noServer=noServer, + ) ) def installPip(self, venvName, userSite=False): @@ -884,9 +897,9 @@ @param callback method accepting a list of tuples containing the package name, installed version and available version @type function - @return list of tuples containing the package name, installed version - and available version - @rtype list of tuple of (str, str, str) + @return dictionary with the package name as key and a tuple containing the + installed and available version as the value + @rtype dict of [str: (str, str)] """ packages = [] @@ -933,11 +946,11 @@ @param proc reference to the process @type QProcess - @return list of tuples containing the package name, installed version - and available version - @rtype list of tuple of (str, str, str) + @return dictionary with the package name as key and a tuple containing the + installed and available version as the value + @rtype dict of [str: (str, str)] """ - packages = [] + packages = {} output = str( proc.readAllStandardOutput(), @@ -953,12 +966,9 @@ for package in jsonList: if isinstance(package, dict): - packages.append( - ( - package["name"], - package["version"], - package["latest_version"], - ) + packages[package["name"]] = ( + package["version"], + package["latest_version"], ) return packages @@ -980,7 +990,7 @@ packages = ( self.__extractOutdatedPackages(proc) if exitStatus == QProcess.ExitStatus.NormalExit and exitCode == 0 - else [] + else {} ) callback(packages) self.__outdatedProc = None @@ -1007,7 +1017,9 @@ start.lower() for start in packageStarts if bool(start) ) filteredPackages = [ - p for p in packages if p[0].lower().startswith(filterStrings) + (p, packages[p][0], packages[p][1]) + for p in packages + if p.lower().startswith(filterStrings) ] else: filteredPackages = []