本文整理汇总了Python中pisi.package.Package.extract_PISI_files方法的典型用法代码示例。如果您正苦于以下问题:Python Package.extract_PISI_files方法的具体用法?Python Package.extract_PISI_files怎么用?Python Package.extract_PISI_files使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pisi.package.Package
的用法示例。
在下文中一共展示了Package.extract_PISI_files方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_package
# 需要导入模块: from pisi.package import Package [as 别名]
# 或者: from pisi.package.Package import extract_PISI_files [as 别名]
def add_package(self, path, repo_uri):
package = Package(path, 'r')
# extract control files
util.clean_dir(ctx.config.install_dir())
package.extract_PISI_files(ctx.config.install_dir())
md = metadata.MetaData()
md.read(os.path.join(ctx.config.install_dir(), ctx.const.metadata_xml))
if ctx.config.options and ctx.config.options.absolute_uris:
md.package.packageURI = os.path.realpath(path)
else: # create relative path by default
# TODO: in the future we'll do all of this with purl/pfile/&helpers
# After that, we'll remove the ugly repo_uri parameter from this
# function.
md.package.packageURI = util.removepathprefix(repo_uri, path)
# check package semantics
if md.has_errors():
ctx.ui.error(_('Package %s: metadata corrupt') % md.package.name)
else:
self.packages.append(md.package)
示例2: add_package
# 需要导入模块: from pisi.package import Package [as 别名]
# 或者: from pisi.package.Package import extract_PISI_files [as 别名]
def add_package(self, path, repo_uri):
package = Package(path, 'r')
# extract control files
util.clean_dir(ctx.config.install_dir())
package.extract_PISI_files(ctx.config.install_dir())
md = metadata.MetaData()
md.read(os.path.join(ctx.config.install_dir(), ctx.const.metadata_xml))
if ctx.config.options and ctx.config.options.absolute_uris:
# FIXME: the name "absolute_uris" does not seem to fit below :/
md.package.packageURI = os.path.realpath(path)
else: # create relative path by default
# TODO: in the future well do all of this with purl/pfile/&helpers
# really? heheh -- future exa
md.package.packageURI = util.removepathprefix(repo_uri, path)
# check package semantics
errs = md.errors()
if md.errors():
ctx.ui.error(_('Package %s: metadata corrupt') % md.package.name)
ctx.ui.error(str(Error(*errs)))
else:
self.packages.append(md.package)