コード例 #1
0
ファイル: test_metadata.py プロジェクト: 40a/distlib
 def test_write(self):
     dfn = self.temp_filename()
     # Read legacy, write new
     sfn = os.path.join(HERE, 'fake_dists', 'choxie-2.0.0.9.dist-info',
                        'METADATA')
     md = Metadata(path=sfn)
     md.write(path=dfn)
     with codecs.open(dfn, 'r', 'utf-8') as f:
         data = json.load(f)
     self.assertEqual(data, {
         'metadata_version': '2.0',
         'generator': 'distlib (%s)' % __version__,
         'name': 'choxie',
         'version': '2.0.0.9',
         'license': 'BSD',
         'summary': 'Chocolate with a kick!',
         'description': 'Chocolate with a longer kick!',
         'provides': ['truffles (1.0)', 'choxie (2.0.0.9)'],
         'run_requires': [{'requires': ['towel-stuff (0.1)', 'nut']}],
         'keywords': [],
     })
     # Write legacy, compare with original
     md.write(path=dfn, legacy=True)
     nmd = Metadata(path=dfn)
     d1 = md.todict()
     d2 = nmd.todict()
     self.assertEqual(d1, d2)
コード例 #2
0
ファイル: test_metadata.py プロジェクト: vsajip/distlib
 def test_write(self):
     dfn = self.temp_filename()
     # Read legacy, write new
     sfn = os.path.join(HERE, 'fake_dists', 'choxie-2.0.0.9.dist-info',
                        LEGACY_METADATA_FILENAME)
     md = Metadata(path=sfn)
     md.write(path=dfn)
     with codecs.open(dfn, 'r', 'utf-8') as f:
         data = json.load(f)
     self.assertEqual(
         data, {
             'metadata_version': '2.0',
             'generator': 'distlib (%s)' % __version__,
             'name': 'choxie',
             'version': '2.0.0.9',
             'license': 'BSD',
             'summary': 'Chocolate with a kick!',
             'description': 'Chocolate with a longer kick!',
             'provides': ['truffles (1.0)', 'choxie (2.0.0.9)'],
             'run_requires': [{
                 'requires': ['towel-stuff (0.1)', 'nut']
             }],
             'keywords': [],
         })
     # Write legacy, compare with original
     md.write(path=dfn, legacy=True)
     nmd = Metadata(path=dfn)
     d1 = md.todict()
     d2 = nmd.todict()
     self.assertEqual(d1, d2)
コード例 #3
0
def process_egg(egg):
    logger.debug(egg)
    pkginfo = os.path.join(egg, 'PKG-INFO')
    toplevel = os.path.join(egg, 'top_level.txt')
    if os.path.exists(pkginfo):
        metadata = Metadata(path=pkginfo)
        logger.debug(metadata.todict())

    return metadata