src/eric7/PipInterface/Pip.py

branch
eric7
changeset 9850
20c49b517679
parent 9786
f94b530722af
child 9851
ec12090e9cd9
equal deleted inserted replaced
9849:99782ca569ed 9850:20c49b517679
1045 1045
1046 ####################################################################### 1046 #######################################################################
1047 ## License handling methods below 1047 ## License handling methods below
1048 ####################################################################### 1048 #######################################################################
1049 1049
1050 def getLicenses(self, envName, localPackages=True, usersite=False, summary=False): 1050 def getLicenses(self, envName, summary=False):
1051 """ 1051 """
1052 Public method to get the licenses per package for a given environment. 1052 Public method to get the licenses per package for a given environment.
1053 1053
1054 @param envName name of the environment to get the licenses for 1054 @param envName name of the environment to get the licenses for
1055 @type str 1055 @type str
1056 @param localPackages flag indicating to get the licenses for local
1057 packages only
1058 @type bool
1059 @param usersite flag indicating to get the licenses for packages
1060 installed in user-site directory only
1061 @type bool
1062 @param summary flag indicating to get a summary listing (defaults to 1056 @param summary flag indicating to get a summary listing (defaults to
1063 False) 1057 False)
1064 @type bool (optional) 1058 @type bool (optional)
1065 @return list of dictionaries containing the license and version per 1059 @return list of dictionaries containing the license and version per
1066 package 1060 package
1078 "--with-system", 1072 "--with-system",
1079 "--with-authors", 1073 "--with-authors",
1080 "--with-urls", 1074 "--with-urls",
1081 "--with-description", 1075 "--with-description",
1082 ] 1076 ]
1083 if localPackages:
1084 args.append("--local-only")
1085 if usersite:
1086 args.append("--user-only")
1087 if summary: 1077 if summary:
1088 args.append("--summary-by-license") 1078 args.append("--summary-by-license")
1089 1079
1090 proc = QProcess() 1080 proc = QProcess()
1091 proc.start(interpreter, args) 1081 proc.start(interpreter, args)
1098 with contextlib.suppress(json.JSONDecodeError): 1088 with contextlib.suppress(json.JSONDecodeError):
1099 licenses = json.loads(output) 1089 licenses = json.loads(output)
1100 1090
1101 return licenses 1091 return licenses
1102 1092
1103 def getLicensesSummary(self, envName, localPackages=True, usersite=False): 1093 def getLicensesSummary(self, envName):
1104 """ 1094 """
1105 Public method to get a summary of licenses found in a given 1095 Public method to get a summary of licenses found in a given
1106 environment. 1096 environment.
1107 1097
1108 @param envName name of the environment to get the licenses summary for 1098 @param envName name of the environment to get the licenses summary for
1109 @type str 1099 @type str
1110 @param localPackages flag indicating to get the licenses summary for
1111 local packages only
1112 @type bool
1113 @param usersite flag indicating to get the licenses summary for
1114 packages installed in user-site directory only
1115 @type bool
1116 @return list of dictionaries containing the license and the count of 1100 @return list of dictionaries containing the license and the count of
1117 packages 1101 packages
1118 @rtype dict 1102 @rtype dict
1119 """ 1103 """
1120 return self.getLicenses( 1104 return self.getLicenses(envName, summary=True)
1121 envName, localPackages=localPackages, usersite=usersite, summary=True
1122 )

eric ide

mercurial