diff --git a/doc/source/user/features.rst b/doc/source/user/features.rst index dfbc18b4..7e2e979f 100644 --- a/doc/source/user/features.rst +++ b/doc/source/user/features.rst @@ -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 ~~~~~~~~~~~~ diff --git a/pbr/core.py b/pbr/core.py index a93253ba..0760ab92 100644 --- a/pbr/core.py +++ b/pbr/core.py @@ -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) diff --git a/releasenotes/notes/long-descr-content-type-f9a1003acbb8740f.yaml b/releasenotes/notes/long-descr-content-type-f9a1003acbb8740f.yaml new file mode 100644 index 00000000..5912332e --- /dev/null +++ b/releasenotes/notes/long-descr-content-type-f9a1003acbb8740f.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + The ``description-content-type`` was not being set correctly. It + will now be correctly populated when using ``setuptools`` 39.2.0 + and beyond.