本文整理汇总了Python中maven_artifact.MavenArtifact.getGATCV方法的典型用法代码示例。如果您正苦于以下问题:Python MavenArtifact.getGATCV方法的具体用法?Python MavenArtifact.getGATCV怎么用?Python MavenArtifact.getGATCV使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类maven_artifact.MavenArtifact
的用法示例。
在下文中一共展示了MavenArtifact.getGATCV方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _filterExcludedTypes
# 需要导入模块: from maven_artifact import MavenArtifact [as 别名]
# 或者: from maven_artifact.MavenArtifact import getGATCV [as 别名]
def _filterExcludedTypes(self, artifactList):
'''
Filter artifactList removing GAVs with specified main types only, otherwise keeping GAVs with
not-excluded artifact types only.
:param artifactList: artifactList to be filtered.
:param exclTypes: list of excluded types
:returns: artifactList without artifacts that matched specified types and had no other main types.
'''
logging.debug("Filtering artifacts with excluded types.")
regExps = maven_repo_util.getRegExpsFromStrings(self.config.gatcvWhitelist)
exclTypes = self.config.excludedTypes
for ga in artifactList.keys():
for priority in artifactList[ga].keys():
for version in artifactList[ga][priority].keys():
artSpec = artifactList[ga][priority][version]
for artType in list(artSpec.artTypes.keys()):
if artType in exclTypes:
artTypeObj = artSpec.artTypes[artType]
classifiers = artTypeObj.classifiers
(groupId, artifactId) = ga.split(':')
for classifier in list(classifiers):
art = MavenArtifact(groupId, artifactId, artType, version, classifier)
gatcv = art.getGATCV()
if not maven_repo_util.somethingMatch(regExps, gatcv):
logging.debug("Dropping classifier \"%s\" of %s:%s:%s from priority %i because of "
"excluded type.", classifier, ga, artType, version, priority)
classifiers.remove(classifier)
else:
logging.debug("Skipping drop of %s:%s:%s:%s from priority %i because it matches a "
"whitelist pattern.", ga, artType, classifier, version, priority)
if not classifiers:
logging.debug("Dropping %s:%s:%s from priority %i because of no classifier left.", ga,
artType, version, priority)
del(artSpec.artTypes[artType])
noMain = True
for artType in artSpec.artTypes.keys():
artTypeObj = artSpec.artTypes[artType]
if artTypeObj.mainType:
noMain = False
break
if not artSpec.artTypes or noMain:
if noMain:
logging.debug("Dropping GAV %s:%s from priority %i because of no main artifact left.",
ga, version, priority)
else:
logging.debug("Dropping GAV %s:%s from priority %i because of no artifact type left.",
ga, version, priority)
del artifactList[ga][priority][version]
if not artifactList[ga][priority]:
logging.debug("Dropping GA %s from priority %i because of no version left.", ga, priority)
del artifactList[ga][priority]
if not artifactList[ga]:
logging.debug("Dropping GA %s because of no priority left.", ga)
del artifactList[ga]
return artifactList