MCPcopy Create free account
hub / github.com/pymupdf/PyMuPDF / _metainfo

Method _metainfo

pipcl.py:1443–1514  ·  view source on GitHub ↗

Returns text for `.egg-info/PKG-INFO` file, or `PKG-INFO` in an sdist `.tar.gz` file, or `...dist-info/METADATA` in a wheel.

(self)

Source from the content-addressed store, hash-verified

1441 return f'{_normalise2(self.name)}-{self.version}.dist-info'
1442
1443 def _metainfo(self):
1444 '''
1445 Returns text for `.egg-info/PKG-INFO` file, or `PKG-INFO` in an sdist
1446 `.tar.gz` file, or `...dist-info/METADATA` in a wheel.
1447 '''
1448 # 2021-04-30: Have been unable to get multiline content working on
1449 # test.pypi.org so we currently put the description as the body after
1450 # all the other headers.
1451 #
1452 ret = ['']
1453 def add(key, value):
1454 if value is None:
1455 return
1456 if isinstance( value, (tuple, list)):
1457 for v in value:
1458 if v is not None:
1459 add( key, v)
1460 return
1461 if key == 'License' and '\n' in value:
1462 # This is ok because we write `self.license` into
1463 # *.dist-info/COPYING.
1464 #
1465 log1( f'Omitting license because contains newline(s).')
1466 return
1467 assert '\n' not in value, f'key={key} value contains newline: {value!r}'
1468 if key == 'Project-URL':
1469 assert value.count(',') == 1, f'For {key=}, should have one comma in {value!r}.'
1470 ret[0] += f'{key}: {value}\n'
1471 #add('Description', self.description)
1472 add('Metadata-Version', '2.1')
1473
1474 # These names are from:
1475 # https://packaging.python.org/specifications/core-metadata/
1476 #
1477 for name in (
1478 'Name',
1479 'Version',
1480 'Platform',
1481 'Supported-Platform',
1482 'Summary',
1483 'Description-Content-Type',
1484 'Keywords',
1485 'Home-page',
1486 'Download-URL',
1487 'Author',
1488 'Author-email',
1489 'Maintainer',
1490 'Maintainer-email',
1491 'License',
1492 'Classifier',
1493 'Requires-Dist',
1494 'Requires-Python',
1495 'Requires-External',
1496 'Project-URL',
1497 'Provides-Extra',
1498 ):
1499 identifier = name.lower().replace( '-', '_')
1500 add( name, getattr( self, identifier))

Callers 4

build_wheelMethod · 0.95
build_sdistMethod · 0.95
installMethod · 0.95
_write_infoMethod · 0.95

Calls 1

addFunction · 0.70

Tested by

no test coverage detected