diff options
author | Éric Araujo <merwok@netwok.org> | 2011-09-10 03:39:45 (GMT) |
---|---|---|
committer | Éric Araujo <merwok@netwok.org> | 2011-09-10 03:39:45 (GMT) |
commit | a13cd39533038b1d841acac5a0f37e55b2fdff53 (patch) | |
tree | a5cee87d81e7a00ad91a91d01e63076f0595a338 /Lib | |
parent | 0c4007641e4be24473aed376d53574801b210151 (diff) | |
download | cpython-a13cd39533038b1d841acac5a0f37e55b2fdff53.zip cpython-a13cd39533038b1d841acac5a0f37e55b2fdff53.tar.gz cpython-a13cd39533038b1d841acac5a0f37e55b2fdff53.tar.bz2 |
Fix determination of Metadata version (#8933). Patch by Filip Gruszczyński.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/distutils/dist.py | 3 | ||||
-rw-r--r-- | Lib/distutils/tests/test_dist.py | 14 |
2 files changed, 16 insertions, 1 deletions
diff --git a/Lib/distutils/dist.py b/Lib/distutils/dist.py index 597909e..e025313 100644 --- a/Lib/distutils/dist.py +++ b/Lib/distutils/dist.py @@ -1111,7 +1111,8 @@ class DistributionMetadata: """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' self._write_field(file, 'Metadata-Version', version) diff --git a/Lib/distutils/tests/test_dist.py b/Lib/distutils/tests/test_dist.py index ff9fa8fc..4b7bbeb 100644 --- a/Lib/distutils/tests/test_dist.py +++ b/Lib/distutils/tests/test_dist.py @@ -245,6 +245,20 @@ class MetadataTestCase(support.TempdirManager, support.EnvironGuard, sys.argv[:] = self.argv[1] 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): long_desc = textwrap.dedent("""\ example:: |