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


Python dist.metadata方法代码示例

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


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

示例1: test_write_pkg_file

# 需要导入模块: from distutils import dist [as 别名]
# 或者: from distutils.dist import metadata [as 别名]
def test_write_pkg_file(self):
        # Check DistributionMetadata handling of Unicode fields
        tmp_dir = self.mkdtemp()
        my_file = os.path.join(tmp_dir, 'f')
        klass = Distribution

        dist = klass(attrs={'author': u'Mister Café',
                            'name': 'my.package',
                            'maintainer': u'Café Junior',
                            'description': u'Café torréfié',
                            'long_description': u'Héhéhé'})

        # let's make sure the file can be written
        # with Unicode fields. they are encoded with
        # PKG_INFO_ENCODING
        dist.metadata.write_pkg_file(open(my_file, 'w'))

        # regular ascii is of course always usable
        dist = klass(attrs={'author': 'Mister Cafe',
                            'name': 'my.package',
                            'maintainer': 'Cafe Junior',
                            'description': 'Cafe torrefie',
                            'long_description': 'Hehehe'})

        my_file2 = os.path.join(tmp_dir, 'f2')
        dist.metadata.write_pkg_file(open(my_file2, 'w')) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:28,代码来源:test_dist.py

示例2: test_finalize_options

# 需要导入模块: from distutils import dist [as 别名]
# 或者: from distutils.dist import metadata [as 别名]
def test_finalize_options(self):
        attrs = {'keywords': 'one,two',
                 'platforms': 'one,two'}

        dist = Distribution(attrs=attrs)
        dist.finalize_options()

        # finalize_option splits platforms and keywords
        self.assertEqual(dist.metadata.platforms, ['one', 'two'])
        self.assertEqual(dist.metadata.keywords, ['one', 'two']) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:12,代码来源:test_dist.py

示例3: test_provides

# 需要导入模块: from distutils import dist [as 别名]
# 或者: from distutils.dist import metadata [as 别名]
def test_provides(self):
        attrs = {"name": "package",
                 "version": "1.0",
                 "provides": ["package", "package.sub"]}
        dist = Distribution(attrs)
        self.assertEqual(dist.metadata.get_provides(),
                         ["package", "package.sub"])
        self.assertEqual(dist.get_provides(),
                         ["package", "package.sub"])
        meta = self.format_metadata(dist)
        self.assertIn("Metadata-Version: 1.1", meta)
        self.assertNotIn("requires:", meta.lower())
        self.assertNotIn("obsoletes:", meta.lower()) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:15,代码来源:test_dist.py

示例4: test_requires

# 需要导入模块: from distutils import dist [as 别名]
# 或者: from distutils.dist import metadata [as 别名]
def test_requires(self):
        attrs = {"name": "package",
                 "version": "1.0",
                 "requires": ["other", "another (==1.0)"]}
        dist = Distribution(attrs)
        self.assertEqual(dist.metadata.get_requires(),
                         ["other", "another (==1.0)"])
        self.assertEqual(dist.get_requires(),
                         ["other", "another (==1.0)"])
        meta = self.format_metadata(dist)
        self.assertIn("Metadata-Version: 1.1", meta)
        self.assertNotIn("provides:", meta.lower())
        self.assertIn("Requires: other", meta)
        self.assertIn("Requires: another (==1.0)", meta)
        self.assertNotIn("obsoletes:", meta.lower()) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:17,代码来源:test_dist.py

示例5: test_obsoletes

# 需要导入模块: from distutils import dist [as 别名]
# 或者: from distutils.dist import metadata [as 别名]
def test_obsoletes(self):
        attrs = {"name": "package",
                 "version": "1.0",
                 "obsoletes": ["other", "another (<1.0)"]}
        dist = Distribution(attrs)
        self.assertEqual(dist.metadata.get_obsoletes(),
                         ["other", "another (<1.0)"])
        self.assertEqual(dist.get_obsoletes(),
                         ["other", "another (<1.0)"])
        meta = self.format_metadata(dist)
        self.assertIn("Metadata-Version: 1.1", meta)
        self.assertNotIn("provides:", meta.lower())
        self.assertNotIn("requires:", meta.lower())
        self.assertIn("Obsoletes: other", meta)
        self.assertIn("Obsoletes: another (<1.0)", meta) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:17,代码来源:test_dist.py

示例6: test_read_metadata

# 需要导入模块: from distutils import dist [as 别名]
# 或者: from distutils.dist import metadata [as 别名]
def test_read_metadata(self):
        attrs = {"name": "package",
                 "version": "1.0",
                 "long_description": "desc",
                 "description": "xxx",
                 "download_url": "http://example.com",
                 "keywords": ['one', 'two'],
                 "requires": ['foo']}

        dist = Distribution(attrs)
        metadata = dist.metadata

        # write it then reloads it
        PKG_INFO = StringIO.StringIO()
        metadata.write_pkg_file(PKG_INFO)
        PKG_INFO.seek(0)
        metadata.read_pkg_file(PKG_INFO)

        self.assertEqual(metadata.name, "package")
        self.assertEqual(metadata.version, "1.0")
        self.assertEqual(metadata.description, "xxx")
        self.assertEqual(metadata.download_url, 'http://example.com')
        self.assertEqual(metadata.keywords, ['one', 'two'])
        self.assertEqual(metadata.platforms, ['UNKNOWN'])
        self.assertEqual(metadata.obsoletes, None)
        self.assertEqual(metadata.requires, ['foo']) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:28,代码来源:test_dist.py

示例7: test_write_pkg_file

# 需要导入模块: from distutils import dist [as 别名]
# 或者: from distutils.dist import metadata [as 别名]
def test_write_pkg_file(self):
        # Check DistributionMetadata handling of Unicode fields
        tmp_dir = self.mkdtemp()
        my_file = os.path.join(tmp_dir, 'f')
        klass = Distribution

        dist = klass(attrs={'author': u'Mister Café',
                            'name': 'my.package',
                            'maintainer': u'Café Junior',
                            'description': u'Café torréfié',
                            'long_description': u'Héhéhé'})


        # let's make sure the file can be written
        # with Unicode fields. they are encoded with
        # PKG_INFO_ENCODING
        dist.metadata.write_pkg_file(open(my_file, 'w'))

        # regular ascii is of course always usable
        dist = klass(attrs={'author': 'Mister Cafe',
                            'name': 'my.package',
                            'maintainer': 'Cafe Junior',
                            'description': 'Cafe torrefie',
                            'long_description': 'Hehehe'})

        my_file2 = os.path.join(tmp_dir, 'f2')
        dist.metadata.write_pkg_file(open(my_file, 'w')) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:29,代码来源:test_dist.py

示例8: test_finalize_options

# 需要导入模块: from distutils import dist [as 别名]
# 或者: from distutils.dist import metadata [as 别名]
def test_finalize_options(self):

        attrs = {'keywords': 'one,two',
                 'platforms': 'one,two'}

        dist = Distribution(attrs=attrs)
        dist.finalize_options()

        # finalize_option splits platforms and keywords
        self.assertEqual(dist.metadata.platforms, ['one', 'two'])
        self.assertEqual(dist.metadata.keywords, ['one', 'two']) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:13,代码来源:test_dist.py

示例9: test_provides

# 需要导入模块: from distutils import dist [as 别名]
# 或者: from distutils.dist import metadata [as 别名]
def test_provides(self):
        attrs = {"name": "package",
                 "version": "1.0",
                 "provides": ["package", "package.sub"]}
        dist = Distribution(attrs)
        self.assertEqual(dist.metadata.get_provides(),
                         ["package", "package.sub"])
        self.assertEqual(dist.get_provides(),
                         ["package", "package.sub"])
        meta = self.format_metadata(dist)
        self.assertTrue("Metadata-Version: 1.1" in meta)
        self.assertTrue("requires:" not in meta.lower())
        self.assertTrue("obsoletes:" not in meta.lower()) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:15,代码来源:test_dist.py

示例10: test_requires

# 需要导入模块: from distutils import dist [as 别名]
# 或者: from distutils.dist import metadata [as 别名]
def test_requires(self):
        attrs = {"name": "package",
                 "version": "1.0",
                 "requires": ["other", "another (==1.0)"]}
        dist = Distribution(attrs)
        self.assertEqual(dist.metadata.get_requires(),
                         ["other", "another (==1.0)"])
        self.assertEqual(dist.get_requires(),
                         ["other", "another (==1.0)"])
        meta = self.format_metadata(dist)
        self.assertTrue("Metadata-Version: 1.1" in meta)
        self.assertTrue("provides:" not in meta.lower())
        self.assertTrue("Requires: other" in meta)
        self.assertTrue("Requires: another (==1.0)" in meta)
        self.assertTrue("obsoletes:" not in meta.lower()) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:17,代码来源:test_dist.py

示例11: test_obsoletes

# 需要导入模块: from distutils import dist [as 别名]
# 或者: from distutils.dist import metadata [as 别名]
def test_obsoletes(self):
        attrs = {"name": "package",
                 "version": "1.0",
                 "obsoletes": ["other", "another (<1.0)"]}
        dist = Distribution(attrs)
        self.assertEqual(dist.metadata.get_obsoletes(),
                         ["other", "another (<1.0)"])
        self.assertEqual(dist.get_obsoletes(),
                         ["other", "another (<1.0)"])
        meta = self.format_metadata(dist)
        self.assertTrue("Metadata-Version: 1.1" in meta)
        self.assertTrue("provides:" not in meta.lower())
        self.assertTrue("requires:" not in meta.lower())
        self.assertTrue("Obsoletes: other" in meta)
        self.assertTrue("Obsoletes: another (<1.0)" in meta) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:17,代码来源:test_dist.py

示例12: format_metadata

# 需要导入模块: from distutils import dist [as 别名]
# 或者: from distutils.dist import metadata [as 别名]
def format_metadata(self, dist):
        sio = StringIO.StringIO()
        dist.metadata.write_pkg_file(sio)
        return sio.getvalue() 
开发者ID:Acmesec,项目名称:CTFCrackTools-V2,代码行数:6,代码来源:test_dist.py


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