当前位置: 首页>>代码示例>>Python>>正文


Python MetaData.write方法代码示例

本文整理汇总了Python中pisi.metadata.MetaData.write方法的典型用法代码示例。如果您正苦于以下问题:Python MetaData.write方法的具体用法?Python MetaData.write怎么用?Python MetaData.write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pisi.metadata.MetaData的用法示例。


在下文中一共展示了MetaData.write方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: gen_metadata_xml

# 需要导入模块: from pisi.metadata import MetaData [as 别名]
# 或者: from pisi.metadata.MetaData import write [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
开发者ID:Tayyib,项目名称:uludag,代码行数:32,代码来源:build.py

示例2: gen_metadata_xml

# 需要导入模块: from pisi.metadata import MetaData [as 别名]
# 或者: from pisi.metadata.MetaData import write [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

        metadata.package.build = build_no

        metadata_xml_path = util.join_path(self.pkg_dir(), ctx.const.metadata_xml)
        metadata.write(metadata_xml_path)
        self.metadata = metadata
开发者ID:dhirajkhatiwada1,项目名称:uludag,代码行数:32,代码来源:build.py

示例3: gen_metadata_xml

# 需要导入模块: from pisi.metadata import MetaData [as 别名]
# 或者: from pisi.metadata.MetaData import write [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
开发者ID:Tayyib,项目名称:uludag,代码行数:34,代码来源:build.py


注:本文中的pisi.metadata.MetaData.write方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。