mirror of
https://github.com/python/cpython.git
synced 2025-08-19 00:00:48 +00:00
Fix determination of Metadata version (#8933). Patch by Filip Gruszczyński.
This commit is contained in:
parent
0c4007641e
commit
a13cd39533
3 changed files with 21 additions and 2 deletions
|
@ -1111,7 +1111,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'
|
||||||
|
|
||||||
self._write_field(file, 'Metadata-Version', version)
|
self._write_field(file, 'Metadata-Version', version)
|
||||||
|
|
|
@ -245,6 +245,20 @@ class MetadataTestCase(support.TempdirManager, support.EnvironGuard,
|
||||||
sys.argv[:] = self.argv[1]
|
sys.argv[:] = self.argv[1]
|
||||||
super(MetadataTestCase, self).tearDown()
|
super(MetadataTestCase, self).tearDown()
|
||||||
|
|
||||||
|
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::
|
||||||
|
|
|
@ -39,7 +39,11 @@ 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 #8286: The distutils command sdist will print a warning message instead
|
- Issue #8286: The distutils command sdist will print a warning message instead
|
||||||
of crashing when an invalid path is given in the manifest template.
|
of crashing when an invalid path is given in the manifest template.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue