Commit 553e21e1 authored by Henk-Jaap Wagenaar's avatar Henk-Jaap Wagenaar

Add setup.cfg support for long_description_content_type (in line with docs).

parent d45be2cc
...@@ -598,7 +598,7 @@ def write_pkg_info(cmd, basename, filename): ...@@ -598,7 +598,7 @@ def write_pkg_info(cmd, basename, filename):
metadata.version, oldver = cmd.egg_version, metadata.version metadata.version, oldver = cmd.egg_version, metadata.version
metadata.name, oldname = cmd.egg_name, metadata.name metadata.name, oldname = cmd.egg_name, metadata.name
metadata.long_description_content_type = getattr( metadata.long_description_content_type = getattr(
cmd.distribution, cmd.distribution.metadata,
'long_description_content_type' 'long_description_content_type'
) )
try: try:
......
...@@ -332,6 +332,13 @@ class Distribution(Distribution_parse_config_files, _Distribution): ...@@ -332,6 +332,13 @@ class Distribution(Distribution_parse_config_files, _Distribution):
for ep in pkg_resources.iter_entry_points('distutils.setup_keywords'): for ep in pkg_resources.iter_entry_points('distutils.setup_keywords'):
vars(self).setdefault(ep.name, None) vars(self).setdefault(ep.name, None)
_Distribution.__init__(self, attrs) _Distribution.__init__(self, attrs)
try:
self.metadata.long_description_content_type
except AttributeError:
self.metadata.long_description_content_type = \
self.long_description_content_type
if isinstance(self.metadata.version, numbers.Number): if isinstance(self.metadata.version, numbers.Number):
# Some people apparently take "version number" too literally :) # Some people apparently take "version number" too literally :)
self.metadata.version = str(self.metadata.version) self.metadata.version = str(self.metadata.version)
......
...@@ -110,6 +110,7 @@ class TestMetadata: ...@@ -110,6 +110,7 @@ class TestMetadata:
'[metadata]\n' '[metadata]\n'
'version = 10.1.1\n' 'version = 10.1.1\n'
'description = Some description\n' 'description = Some description\n'
'long_description_content_type = text/something\n'
'long_description = file: README\n' 'long_description = file: README\n'
'name = fake_name\n' 'name = fake_name\n'
'keywords = one, two\n' 'keywords = one, two\n'
...@@ -131,6 +132,7 @@ class TestMetadata: ...@@ -131,6 +132,7 @@ class TestMetadata:
assert metadata.version == '10.1.1' assert metadata.version == '10.1.1'
assert metadata.description == 'Some description' assert metadata.description == 'Some description'
assert metadata.long_description_content_type == 'text/something'
assert metadata.long_description == 'readme contents\nline2' assert metadata.long_description == 'readme contents\nline2'
assert metadata.provides == ['package', 'package.sub'] assert metadata.provides == ['package', 'package.sub']
assert metadata.license == 'BSD 3-Clause License' assert metadata.license == 'BSD 3-Clause License'
......
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