本文整理汇总了Python中pisi.metadata.MetaData.from_spec方法的典型用法代码示例。如果您正苦于以下问题:Python MetaData.from_spec方法的具体用法?Python MetaData.from_spec怎么用?Python MetaData.from_spec使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pisi.metadata.MetaData
的用法示例。
在下文中一共展示了MetaData.from_spec方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: gen_metadata_xml
# 需要导入模块: from pisi.metadata import MetaData [as 别名]
# 或者: from pisi.metadata.MetaData import from_spec [as 别名]
def gen_metadata_xml(self, package, build_no=None):
"""Generate the metadata.xml file for build source.
metadata.xml is composed of the information from specfile plus
some additional information."""
metadata = MetaData()
metadata.from_spec(self.spec.source, package)
metadata.package.distribution = ctx.config.values.general.distribution
metadata.package.distributionRelease = ctx.config.values.general.distribution_release
metadata.package.architecture = "Any"
metadata.package.packageFormat = ctx.get_option('package_format')
size = 0
if package.debug_package:
d = self.pkg_debug_dir()
else:
d = self.pkg_install_dir()
for path in package.files:
for p in glob.glob(util.join_path(d, path.path)):
size += util.dir_size(p)
metadata.package.installedSize = size
self.metadata = metadata
示例2: gen_metadata_xml
# 需要导入模块: from pisi.metadata import MetaData [as 别名]
# 或者: from pisi.metadata.MetaData import from_spec [as 别名]
def gen_metadata_xml(self, package):
"""Generate the metadata.xml file for build source.
metadata.xml is composed of the information from specfile plus
some additional information."""
metadata = MetaData()
metadata.from_spec(self.spec.source, package)
metadata.package.distribution = ctx.config.values.general.distribution
metadata.package.distributionRelease = ctx.config.values.general.distribution_release
metadata.package.architecture = "Any"
size, d = 0, self.pkg_install_dir()
for path in package.files:
size += util.dir_size(util.join_path(d, path.path))
metadata.package.installedSize = size
# build no
if ctx.config.options.ignore_build_no:
metadata.package.build = None # means, build no information n/a
ctx.ui.warning(_('Build number is not available due to --ignore-build'))
elif (not ctx.config.values.build.buildno):
metadata.package.build = None
ctx.ui.warning(_('Build number is not available. For repo builds you must enable buildno in pisi.conf.'))
else:
metadata.package.build = self.calc_build_no(metadata.package.name)
metadata_xml_path = util.join_path(self.pkg_dir(), ctx.const.metadata_xml)
metadata.write(metadata_xml_path)
self.metadata = metadata
示例3: gen_metadata_xml
# 需要导入模块: from pisi.metadata import MetaData [as 别名]
# 或者: from pisi.metadata.MetaData import from_spec [as 别名]
def gen_metadata_xml(self, package):
"""Generate the metadata.xml file for build source.
metadata.xml is composed of the information from specfile plus
some additional information."""
metadata = MetaData()
metadata.from_spec(self.spec.source, package)
metadata.package.distribution = ctx.config.values.general.distribution
metadata.package.distributionRelease = ctx.config.values.general.distribution_release
metadata.package.architecture = "Any"
# FIXME: Bu hatalı. installsize'ı almak için tüm
# pkg_install_dir()'ın boyutunu hesaplayamayız. Bir source
# birden fazla kaynak üretebilir. package.paths ile
# karşılaştırarak file listesinden boyutları hesaplatmalıyız.
d = self.bctx.pkg_install_dir()
size = util.dir_size(d)
metadata.package.installedSize = str(size)
# build no
if ctx.config.options.ignore_build_no:
metadata.package.build = None # means, build no information n/a
ctx.ui.warning('build number is not available.')
else:
metadata.package.build = self.calc_build_no(metadata.package.name)
metadata_xml_path = os.path.join(self.bctx.pkg_dir(), ctx.const.metadata_xml)
metadata.write(metadata_xml_path)
self.metadata = metadata
示例4: gen_metadata_xml
# 需要导入模块: from pisi.metadata import MetaData [as 别名]
# 或者: from pisi.metadata.MetaData import from_spec [as 别名]
def gen_metadata_xml(self, package, build_no=None):
"""Generate the metadata.xml file for build source.
metadata.xml is composed of the information from specfile plus
some additional information."""
metadata = MetaData()
metadata.from_spec(self.spec.source, package, self.spec.history)
metadata.package.distribution = ctx.config.values.general.distribution
metadata.package.distributionRelease = ctx.config.values.general.distribution_release
metadata.package.architecture = "Any"
metadata.package.packageFormat = ctx.get_option('package_format')
size = 0
for fileinfo in self.files.list:
size += fileinfo.size
metadata.package.installedSize = size
self.metadata = metadata