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

Original patch by Filip Gruszczyński.
This commit is contained in:
Éric Araujo 2011-09-10 05:22:48 +02:00
parent 6bbd775377
commit e6db7a3a29
3 changed files with 19 additions and 5 deletions

View File

@ -61,7 +61,8 @@ _314_FIELDS = ('Metadata-Version', 'Name', 'Version', 'Platform',
'License', 'Classifier', 'Download-URL', 'Obsoletes',
'Provides', 'Requires')
_314_MARKERS = ('Obsoletes', 'Provides', 'Requires')
_314_MARKERS = ('Obsoletes', 'Provides', 'Requires', 'Classifier',
'Download-URL')
_345_FIELDS = ('Metadata-Version', 'Name', 'Version', 'Platform',
'Supported-Platform', 'Summary', 'Description',

View File

@ -251,7 +251,11 @@ class MetadataTestCase(LoggingCatcher,
self.assertNotIn('Obsoletes', metadata)
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['Obsoletes'] = 'ok'
@ -269,6 +273,15 @@ class MetadataTestCase(LoggingCatcher,
metadata['Version'] = '1'
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__),
'SETUPTOOLS-PKG-INFO')
metadata = Metadata(PKG_INFO)

View File

@ -274,9 +274,9 @@ Core and Builtins
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 #8933: distutils' PKG-INFO files and packaging's METADATA files will
now correctly report Metadata-Version: 1.1 instead of 1.0 if a Classifier or
Download-URL field is present.
- Issue #12567: Add curses.unget_wch() function. Push a character so the next
get_wch() will return it.