Commit 77e75e25 authored by Ian Wienand's avatar Ian Wienand Committed by Stephen Finucane

Special case long_description_content_type

As described in the pypa pull request, special-case passing through
these fields into the metadata.  setuptools will maintain them.

Change-Id: I89eb8c6d627790680a61a0a4b7490191b6e8e90c
Closes-Bug: #1762494
parent f14a3b2b
......@@ -181,6 +181,10 @@ probably a good long_description. So we'll just inject the contents of your
You can also specify the exact file you want to use using the
``description-file`` parameter.
You can set the ``description-content-type`` to a MIME type that may
help rendering of the description; for example ``text/markdown`` or
``text/x-rst; charset=UTF-8``.
Requirements
~~~~~~~~~~~~
......
......@@ -103,6 +103,16 @@ def pbr(dist, attr, value):
raise errors.DistutilsSetupError(
'Error parsing %s: %s: %s' % (path, e.__class__.__name__, e))
# There are some metadata fields that are only supported by
# setuptools and not distutils, and hence are not in
# dist.metadata. We are OK to write these in. For gory details
# see
# https://github.com/pypa/setuptools/pull/1343
_DISTUTILS_UNSUPPORTED_METADATA = (
'long_description_content_type', 'project_urls', 'provides_extras'
)
# Repeat some of the Distribution initialization code with the newly
# provided attrs
if attrs:
......@@ -115,6 +125,8 @@ def pbr(dist, attr, value):
setattr(dist.metadata, key, val)
elif hasattr(dist, key):
setattr(dist, key, val)
elif key in _DISTUTILS_UNSUPPORTED_METADATA:
setattr(dist.metadata, key, val)
else:
msg = 'Unknown distribution option: %s' % repr(key)
warnings.warn(msg)
......
---
fixes:
- |
The ``description-content-type`` was not being set correctly. It
will now be correctly populated when using ``setuptools`` 39.2.0
and beyond.
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