mirror of
https://github.com/python/cpython.git
synced 2025-11-14 15:56:48 +00:00
Fix determination of Metadata version (#8933). Patch by Filip Gruszczyński.
This commit is contained in:
parent
fce67fcd84
commit
13e8c8e721
3 changed files with 20 additions and 1 deletions
|
|
@ -1018,7 +1018,8 @@ class DistributionMetadata:
|
||||||
"""Write the PKG-INFO format data to a file object.
|
"""Write the PKG-INFO format data to a file object.
|
||||||
"""
|
"""
|
||||||
version = '1.0'
|
version = '1.0'
|
||||||
if self.provides or self.requires or self.obsoletes:
|
if (self.provides or self.requires or self.obsoletes or
|
||||||
|
self.classifiers or self.download_url):
|
||||||
version = '1.1'
|
version = '1.1'
|
||||||
|
|
||||||
file.write('Metadata-Version: %s\n' % version)
|
file.write('Metadata-Version: %s\n' % version)
|
||||||
|
|
|
||||||
|
|
@ -244,6 +244,20 @@ class MetadataTestCase(support.TempdirManager, support.EnvironGuard,
|
||||||
"version": "1.0",
|
"version": "1.0",
|
||||||
"obsoletes": ["my.pkg (splat)"]})
|
"obsoletes": ["my.pkg (splat)"]})
|
||||||
|
|
||||||
|
def test_classifier(self):
|
||||||
|
attrs = {'name': 'Boa', 'version': '3.0',
|
||||||
|
'classifiers': ['Programming Language :: Python :: 3']}
|
||||||
|
dist = Distribution(attrs)
|
||||||
|
meta = self.format_metadata(dist)
|
||||||
|
self.assertIn('Metadata-Version: 1.1', meta)
|
||||||
|
|
||||||
|
def test_download_url(self):
|
||||||
|
attrs = {'name': 'Boa', 'version': '3.0',
|
||||||
|
'download_url': 'http://example.org/boa'}
|
||||||
|
dist = Distribution(attrs)
|
||||||
|
meta = self.format_metadata(dist)
|
||||||
|
self.assertIn('Metadata-Version: 1.1', meta)
|
||||||
|
|
||||||
def test_long_description(self):
|
def test_long_description(self):
|
||||||
long_desc = textwrap.dedent("""\
|
long_desc = textwrap.dedent("""\
|
||||||
example::
|
example::
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,10 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #8933: distutils' PKG-INFO files will now correctly report
|
||||||
|
Metadata-Version: 1.1 instead of 1.0 if a Classifier or Download-URL field is
|
||||||
|
present.
|
||||||
|
|
||||||
- Issue #9561: distutils now reads and writes egg-info files using UTF-8,
|
- Issue #9561: distutils now reads and writes egg-info files using UTF-8,
|
||||||
instead of the locale encoding.
|
instead of the locale encoding.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue