eric7/PipInterface/Pip.py

branch
eric7
changeset 9003
6bc210cd5726
parent 9002
31a7decd3393
child 9016
6f079c524e99
--- a/eric7/PipInterface/Pip.py	Sun Mar 27 19:56:41 2022 +0200
+++ b/eric7/PipInterface/Pip.py	Mon Mar 28 18:13:15 2022 +0200
@@ -975,12 +975,19 @@
     ## License handling methods below
     #######################################################################
     
-    def getLicenses(self, envName, summary=False):
+    def getLicenses(self, envName, localPackages=True, usersite=False,
+                    summary=False):
         """
         Public method to get the licenses per package for a given environment.
         
         @param envName name of the environment to get the licenses for
         @type str
+        @param localPackages flag indicating to get the licenses for local
+            packages only
+        @type bool
+        @param usersite flag indicating to get the licenses for packages
+            installed in user-site directory only
+        @type bool
         @param summary flag indicating to get a summary listing (defaults to
             False)
         @type bool (optional)
@@ -999,12 +1006,14 @@
                 args = [
                     "-c",
                     content,
-                    "--format",
-                    "json",
                     "--from",
                     "mixed",
                     "--with-system",
                 ]
+                if localPackages:
+                    args.append("--local-only")
+                if usersite:
+                    args.append("--user-only")
                 if summary:
                     args.append("--summary")
                 
@@ -1019,15 +1028,22 @@
         
         return licenses
     
-    def getLicensesSummary(self, envName):
+    def getLicensesSummary(self, envName, localPackages=True, usersite=False):
         """
         Public method to get a summary of licenses found in a given
         environment.
         
         @param envName name of the environment to get the licenses summary for
         @type str
+        @param localPackages flag indicating to get the licenses summary for
+            local packages only
+        @type bool
+        @param usersite flag indicating to get the licenses summary for
+            packages installed in user-site directory only
+        @type bool
         @return list of dictionaries containing the license and the count of
             packages
         @rtype dict
         """
-        return self.getLicenses(envName, summary=True)
+        return self.getLicenses(envName, localPackages=localPackages,
+                                usersite=usersite, summary=True)

eric ide

mercurial