本文整理匯總了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()