Kaydet (Commit) e6db7a3a authored tarafından Éric Araujo's avatar Éric Araujo

Fix determination of Metadata version in packaging (#8933).

Original patch by Filip Gruszczyński.
üst 6bbd7753
...@@ -61,7 +61,8 @@ _314_FIELDS = ('Metadata-Version', 'Name', 'Version', 'Platform', ...@@ -61,7 +61,8 @@ _314_FIELDS = ('Metadata-Version', 'Name', 'Version', 'Platform',
'License', 'Classifier', 'Download-URL', 'Obsoletes', 'License', 'Classifier', 'Download-URL', 'Obsoletes',
'Provides', 'Requires') 'Provides', 'Requires')
_314_MARKERS = ('Obsoletes', 'Provides', 'Requires') _314_MARKERS = ('Obsoletes', 'Provides', 'Requires', 'Classifier',
'Download-URL')
_345_FIELDS = ('Metadata-Version', 'Name', 'Version', 'Platform', _345_FIELDS = ('Metadata-Version', 'Name', 'Version', 'Platform',
'Supported-Platform', 'Summary', 'Description', 'Supported-Platform', 'Summary', 'Description',
......
...@@ -251,7 +251,11 @@ class MetadataTestCase(LoggingCatcher, ...@@ -251,7 +251,11 @@ class MetadataTestCase(LoggingCatcher,
self.assertNotIn('Obsoletes', metadata) self.assertNotIn('Obsoletes', metadata)
metadata['Classifier'] = ['ok'] metadata['Classifier'] = ['ok']
self.assertEqual(metadata['Metadata-Version'], '1.2') self.assertEqual(metadata['Metadata-Version'], '1.1')
metadata = Metadata()
metadata['Download-URL'] = 'ok'
self.assertEqual(metadata['Metadata-Version'], '1.1')
metadata = Metadata() metadata = Metadata()
metadata['Obsoletes'] = 'ok' metadata['Obsoletes'] = 'ok'
...@@ -269,6 +273,15 @@ class MetadataTestCase(LoggingCatcher, ...@@ -269,6 +273,15 @@ class MetadataTestCase(LoggingCatcher,
metadata['Version'] = '1' metadata['Version'] = '1'
self.assertEqual(metadata['Metadata-Version'], '1.0') self.assertEqual(metadata['Metadata-Version'], '1.0')
# make sure the _best_version function works okay with
# non-conflicting fields from 1.1 and 1.2 (i.e. we want only the
# requires/requires-dist and co. pairs to cause a conflict, not all
# fields in _314_MARKERS)
metadata = Metadata()
metadata['Requires-Python'] = '3'
metadata['Classifier'] = ['Programming language :: Python :: 3']
self.assertEqual(metadata['Metadata-Version'], '1.2')
PKG_INFO = os.path.join(os.path.dirname(__file__), PKG_INFO = os.path.join(os.path.dirname(__file__),
'SETUPTOOLS-PKG-INFO') 'SETUPTOOLS-PKG-INFO')
metadata = Metadata(PKG_INFO) metadata = Metadata(PKG_INFO)
......
...@@ -274,9 +274,9 @@ Core and Builtins ...@@ -274,9 +274,9 @@ Core and Builtins
Library Library
------- -------
- Issue #8933: distutils' PKG-INFO files will now correctly report - Issue #8933: distutils' PKG-INFO files and packaging's METADATA files will
Metadata-Version: 1.1 instead of 1.0 if a Classifier or Download-URL field is now correctly report Metadata-Version: 1.1 instead of 1.0 if a Classifier or
present. Download-URL field is present.
- Issue #12567: Add curses.unget_wch() function. Push a character so the next - Issue #12567: Add curses.unget_wch() function. Push a character so the next
get_wch() will return it. get_wch() will return it.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment