src/eric7/PipInterface/Pip.py

branch
eric7
changeset 9851
ec12090e9cd9
parent 9850
20c49b517679
child 9940
a57c188857e9
child 10084
125166c6b66c
equal deleted inserted replaced
9850:20c49b517679 9851:ec12090e9cd9
1045 1045
1046 ####################################################################### 1046 #######################################################################
1047 ## License handling methods below 1047 ## License handling methods below
1048 ####################################################################### 1048 #######################################################################
1049 1049
1050 def getLicenses(self, envName, summary=False): 1050 def getLicenses(self, envName):
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 summary flag indicating to get a summary listing (defaults to
1057 False)
1058 @type bool (optional)
1059 @return list of dictionaries containing the license and version per 1056 @return list of dictionaries containing the license and version per
1060 package 1057 package
1061 @rtype dict 1058 @rtype dict
1062 """ 1059 """
1063 licenses = [] 1060 licenses = []
1072 "--with-system", 1069 "--with-system",
1073 "--with-authors", 1070 "--with-authors",
1074 "--with-urls", 1071 "--with-urls",
1075 "--with-description", 1072 "--with-description",
1076 ] 1073 ]
1077 if summary:
1078 args.append("--summary-by-license")
1079 1074
1080 proc = QProcess() 1075 proc = QProcess()
1081 proc.start(interpreter, args) 1076 proc.start(interpreter, args)
1082 if proc.waitForStarted(15000) and proc.waitForFinished(30000): 1077 if proc.waitForStarted(15000) and proc.waitForFinished(30000):
1083 output = str( 1078 output = str(
1087 ).strip() 1082 ).strip()
1088 with contextlib.suppress(json.JSONDecodeError): 1083 with contextlib.suppress(json.JSONDecodeError):
1089 licenses = json.loads(output) 1084 licenses = json.loads(output)
1090 1085
1091 return licenses 1086 return licenses
1092
1093 def getLicensesSummary(self, envName):
1094 """
1095 Public method to get a summary of licenses found in a given
1096 environment.
1097
1098 @param envName name of the environment to get the licenses summary for
1099 @type str
1100 @return list of dictionaries containing the license and the count of
1101 packages
1102 @rtype dict
1103 """
1104 return self.getLicenses(envName, summary=True)

eric ide

mercurial