本文整理汇总了Python中package.Package.name方法的典型用法代码示例。如果您正苦于以下问题:Python Package.name方法的具体用法?Python Package.name怎么用?Python Package.name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类package.Package
的用法示例。
在下文中一共展示了Package.name方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_newest_build
# 需要导入模块: from package import Package [as 别名]
# 或者: from package.Package import name [as 别名]
def get_newest_build(self, branch, pkgname):
""" Returns the newest 'Package' for a given branch and package name """
builds = self.session.getLatestRPMS(branch, package=pkgname, arch='src')
if len(builds[0]) == 0:
return None
latest = builds[0][0]
pkg = Package()
pkg.name = latest['name']
pkg.version = latest['version']
pkg.release = latest['release']
return pkg
示例2: main
# 需要导入模块: from package import Package [as 别名]
# 或者: from package.Package import name [as 别名]
def main():
parser = argparse.ArgumentParser(description='Build a list of packages')
parser.add_argument('--branch-source', default="f21", help='The branch to use as a source')
parser.add_argument('--copr-id', default="el7-gnome-3-14", help='The COPR to use')
parser.add_argument('--packages', default="./data/el7-gnome-3-14.txt", help='the list if packages to build')
args = parser.parse_args()
copr = CoprHelper(args.copr_id)
koji = KojiHelper()
data = ModulesXml('modules.xml')
# add the copr id (e.g. el7) to any items in modules.xml file
f = open(args.packages, 'r')
for l in f.readlines():
if l.startswith('#'):
continue
if l.startswith('\n'):
continue
linedata = l.strip().split(',')
pkgname = linedata[0]
item = data._get_item_by_pkgname(pkgname)
if not item:
print("%s not found" % pkgname)
continue
item.releases.append(copr.release)
item.custom_package_url = None
if len(linedata) > 1:
item.custom_package_url = linedata[1]
f.close()
# disable any modules without the copr-specific release
for item in data.items:
if copr.release not in item.releases:
item.disabled = True
continue
# depsolve
print_debug("Depsolving moduleset...")
if not data.depsolve():
print_fail("Failed to depsolve")
return
# process all packages
current_depsolve_level = 0
for item in data.items:
if item.disabled:
continue;
# wait for builds
if current_depsolve_level != item.depsolve_level:
rc = copr.wait_for_builds()
if not rc:
print_fail("A build failed, so aborting")
break
current_depsolve_level = item.depsolve_level
print_debug("Now running depsolve level %i" % current_depsolve_level)
# find the koji package
pkg = None
if not item.custom_package_url:
pkg = koji.get_newest_build(args.branch_source, item.pkgname)
if not pkg:
print_fail("package %s does not exists in koji" % item.pkgname)
continue
pkg2 = koji.get_newest_build(args.branch_source + '-updates-candidate', item.pkgname)
if not pkg2:
print_fail("package %s does not exists in koji" % item.pkgname)
continue
# use the newest package
if pkg.get_nvr() != pkg2.get_nvr():
if rpm.labelCompare(pkg.get_evr(), pkg2.get_evr()) < 0:
pkg = pkg2;
else:
pkg = Package()
nvr = os.path.basename(item.custom_package_url).rsplit('-', 2)
pkg.name = nvr[0]
pkg.version = nvr[1]
pkg.release = nvr[2].replace('.src.rpm', '')
pkg.url = item.custom_package_url
print_debug("Latest version of %s: %s" % (item.pkgname, pkg.get_nvr()))
# find if the package has been built in the copr
try:
status = copr.get_pkg_status(pkg)
except CoprException, e:
print_fail(str(e))
continue
if status == CoprBuildStatus.ALREADY_BUILT:
print_debug("Already built")
continue
elif status == CoprBuildStatus.FAILED_TO_BUILD:
print_debug("Failed, so retrying build")
elif status == CoprBuildStatus.NOT_FOUND:
print_debug("Not found, so building")
elif status == CoprBuildStatus.IN_PROGRESS:
print_debug("Already in progress")
#.........这里部分代码省略.........
示例3: open
# 需要导入模块: from package import Package [as 别名]
# 或者: from package.Package import name [as 别名]
# Argv Parasing #
##########################################
for v in sys.argv:
if v == "-f" or v == "-force":
forceUpdate = True
if v == "-d" or v == "-debug":
debug = True
##########################################
# Main Loop #
##########################################
with open(CONFIG_FILE, "r") as f:
for name in f:
pack = Package() # create new Package Object
pack.name = name.strip()
respString = getHttpResponseString(pack.name)
pack.updateTime = parseDateString(getUpdateTime(respString))
pack.gitPath = AUR_CLONE_URL + pack.name + ".git"
pack.localPath = CLONE_PATH + pack.name + "/PKGBUILD"
if os.path.isfile(pack.localPath):
pack.installTime = os.path.getmtime(pack.localPath)
timeDif = pack.updateTime - pack.installTime
else:
clonePackage(pack)
exit()
if debug == True:
print("{}, {}".format(pack.name, pack.updateTime))