本文整理汇总了Python中StringUtils.StringUtils.getPackageVersionFromURL方法的典型用法代码示例。如果您正苦于以下问题:Python StringUtils.getPackageVersionFromURL方法的具体用法?Python StringUtils.getPackageVersionFromURL怎么用?Python StringUtils.getPackageVersionFromURL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringUtils.StringUtils
的用法示例。
在下文中一共展示了StringUtils.getPackageVersionFromURL方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: buildSourcesList
# 需要导入模块: from StringUtils import StringUtils [as 别名]
# 或者: from StringUtils.StringUtils import getPackageVersionFromURL [as 别名]
def buildSourcesList(specPath, yamlDir, singleFile=False):
strUtils = StringUtils()
if singleFile:
yamlFile = open(yamlDir+"sources_list.yaml", "w")
lst = os.listdir(specPath)
lst.sort()
for dirEntry in lst:
specDir = os.path.join(specPath, dirEntry)
if os.path.isdir(specDir):
for specEntry in os.listdir(specDir):
specFile = os.path.join(specDir, specEntry)
if os.path.isfile(specFile) and specFile.endswith(".spec"):
spec=Specutils(specFile)
modified = len(spec.getPatchNames()) > 0
ss=spec.getSourceURLs()
for s in ss:
if (s.startswith("http") or s.startswith("ftp")):
ossname=strUtils.getPackageNameFromURL(s)
ossversion=strUtils.getPackageVersionFromURL(s)
if not singleFile:
yamlFile = open(yamlDir+ossname+"-"+ossversion+".yaml", "w")
yamlFile.write("vmwsource:"+ossname+":"+ossversion+":\n")
yamlFile.write(" repository: VMWsource\n")
yamlFile.write(" name: '"+ossname+"'\n")
yamlFile.write(" version: '"+ossversion+"'\n")
yamlFile.write(" url: "+s+"\n")
yamlFile.write(" license: UNKNOWN\n")
if modified:
yamlFile.write(" modified: true\n")
yamlFile.write("\n")
if not singleFile:
yamlFile.close()
if singleFile:
yamlFile.close()