summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsetup.py1
-rwxr-xr-xsetuptools/command/egg_info.py4
-rw-r--r--setuptools/dist.py10
3 files changed, 15 insertions, 0 deletions
diff --git a/setup.py b/setup.py
index d7a13445..a02e41aa 100755
--- a/setup.py
+++ b/setup.py
@@ -95,6 +95,7 @@ setup_params = dict(
author="Python Packaging Authority",
author_email="distutils-sig@python.org",
long_description=long_description,
+ long_description_content_type='text/x-rst; charset=UTF-8',
keywords="CPAN PyPI distutils eggs package management",
url="https://github.com/pypa/setuptools",
src_root=None,
diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py
index 6c00b0b7..a183d15d 100755
--- a/setuptools/command/egg_info.py
+++ b/setuptools/command/egg_info.py
@@ -599,6 +599,10 @@ def write_pkg_info(cmd, basename, filename):
metadata = cmd.distribution.metadata
metadata.version, oldver = cmd.egg_version, metadata.version
metadata.name, oldname = cmd.egg_name, metadata.name
+ metadata.long_description_content_type = getattr(
+ cmd.distribution,
+ 'long_description_content_type'
+ )
try:
# write unescaped data to PKG-INFO, so older pkg_resources
# can still parse it
diff --git a/setuptools/dist.py b/setuptools/dist.py
index 21730f22..084641a8 100644
--- a/setuptools/dist.py
+++ b/setuptools/dist.py
@@ -58,6 +58,13 @@ def write_pkg_file(self, file):
if self.download_url:
file.write('Download-URL: %s\n' % self.download_url)
+ long_desc_content_type = getattr(
+ self,
+ 'long_description_content_type',
+ None
+ ) or 'UNKNOWN'
+ file.write('Description-Content-Type: %s\n' % long_desc_content_type)
+
long_desc = rfc822_escape(self.get_long_description())
file.write('Description: %s\n' % long_desc)
@@ -317,6 +324,9 @@ class Distribution(Distribution_parse_config_files, _Distribution):
self.dist_files = []
self.src_root = attrs and attrs.pop("src_root", None)
self.patch_missing_pkg_info(attrs)
+ self.long_description_content_type = _attrs_dict.get(
+ 'long_description_content_type'
+ )
# Make sure we have any eggs needed to interpret 'attrs'
if attrs is not None:
self.dependency_links = attrs.pop('dependency_links', [])