summaryrefslogtreecommitdiff
path: root/setuptools/dist.py
diff options
context:
space:
mode:
authorMarc Abramowitz <marc@marc-abramowitz.com>2016-07-30 08:15:53 -0700
committerDustin Ingram <di@users.noreply.github.com>2017-08-28 12:32:11 -0500
commit4fc60ed1e47f725a833dd63656ceec981a58e1a0 (patch)
tree647d0139be73475e45d74101ed00666875f5db23 /setuptools/dist.py
parentb4d58d4929dd4e19870b5eafa48046a0a0c2bf07 (diff)
downloadpython-setuptools-git-4fc60ed1e47f725a833dd63656ceec981a58e1a0.tar.gz
Add new long_description_content_type kwarg
This is used to populate the new `Description-Content-Type` field. `Description-Content-Type` is described at https://github.com/pypa/python-packaging-user-guide/pull/258
Diffstat (limited to 'setuptools/dist.py')
-rw-r--r--setuptools/dist.py10
1 files changed, 10 insertions, 0 deletions
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', [])