src/eric7/PipInterface/Pip.py

branch
eric7
changeset 9578
bbe0a4b0832e
parent 9482
a2bc06a54d9d
child 9580
123a7eadc798
--- a/src/eric7/PipInterface/Pip.py	Tue Dec 06 17:42:24 2022 +0100
+++ b/src/eric7/PipInterface/Pip.py	Tue Dec 06 19:46:18 2022 +0100
@@ -675,7 +675,8 @@
         return packages
 
     def getOutdatedPackages(
-        self, envName, localPackages=True, notRequired=False, usersite=False
+        self, envName, localPackages=True, notRequired=False, usersite=False,
+        interpreter=None
     ):
         """
         Public method to get the list of outdated packages.
@@ -683,13 +684,17 @@
         @param envName name of the environment to get the packages for
         @type str
         @param localPackages flag indicating to get local packages only
-        @type bool
+            (defaults to False)
+        @type bool (optional)
         @param notRequired flag indicating to list packages that are not
-            dependencies of installed packages as well
-        @type bool
+            dependencies of installed packages as well (defaults to False)
+        @type bool (optional)
         @param usersite flag indicating to only list packages installed
-            in user-site
-        @type bool
+            in user-site (defaults to False)
+        @type bool (optional)
+        @param interpreter path of an interpreter executable. If this is not
+            None, it will override the given environment name (defaults to None)
+        @type str (optional)
         @return list of tuples containing the package name, installed version
             and available version
         @rtype list of tuple of (str, str, str)
@@ -697,7 +702,8 @@
         packages = []
 
         if envName:
-            interpreter = self.getVirtualenvInterpreter(envName)
+            if interpreter is None:
+                interpreter = self.getVirtualenvInterpreter(envName)
             if interpreter:
                 args = [
                     "-m",
@@ -746,7 +752,7 @@
 
         return packages
 
-    def checkPackageOutdated(self, packageStart, envName):
+    def checkPackageOutdated(self, packageStart, envName, interpreter=None):
         """
         Public method to check, if a group of packages is outdated.
 
@@ -755,6 +761,9 @@
         @type str
         @param envName name of the environment to get the packages for
         @type str
+        @param interpreter path of an interpreter executable. If this is not
+            None, it will override the given environment name (defaults to None)
+        @type str (optional)
         @return tuple containing a flag indicating outdated packages and the
             list of tuples containing the package name, installed version
             and available version
@@ -763,7 +772,7 @@
         filteredPackages = []
 
         if bool(envName) and bool(packageStart):
-            packages = self.getOutdatedPackages(envName)
+            packages = self.getOutdatedPackages(envName, interpreter=interpreter)
             filterStr = packageStart.lower()
             filteredPackages = [
                 p for p in packages if p[0].lower().startswith(filterStr)

eric ide

mercurial