[Python-checkins] cpython (3.2): Fix determination of Metadata version (#8933). Patch by Filip Gruszczyński.
eric.araujo
python-checkins at python.org
Mon Sep 12 17:42:15 CEST 2011
http://hg.python.org/cpython/rev/e5c1de856828
changeset: 72347:e5c1de856828
branch: 3.2
user: Éric Araujo <merwok at netwok.org>
date: Sat Sep 10 01:51:40 2011 +0200
summary:
Fix determination of Metadata version (#8933). Patch by Filip Gruszczyński.
files:
Lib/distutils/dist.py | 3 ++-
Lib/distutils/tests/test_dist.py | 14 ++++++++++++++
Misc/NEWS | 4 ++++
3 files changed, 20 insertions(+), 1 deletions(-)
diff --git a/Lib/distutils/dist.py b/Lib/distutils/dist.py
--- a/Lib/distutils/dist.py
+++ b/Lib/distutils/dist.py
@@ -1018,7 +1018,8 @@
"""Write the PKG-INFO format data to a file object.
"""
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'
file.write('Metadata-Version: %s\n' % version)
diff --git a/Lib/distutils/tests/test_dist.py b/Lib/distutils/tests/test_dist.py
--- a/Lib/distutils/tests/test_dist.py
+++ b/Lib/distutils/tests/test_dist.py
@@ -244,6 +244,20 @@
"version": "1.0",
"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):
long_desc = textwrap.dedent("""\
example::
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -25,6 +25,10 @@
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,
instead of the locale encoding.
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list