Support PEP 345 Project-URL metadata

By including one or more Project-URL entries in PKG-INFO metadata,
PyPI can display helpful hyperlinks in a generic manner. Add support
here to be able to pass it through setup.cfg with a project_urls
dict. See the corresponding section of the Core Metadata
Specifications from the Python Packaging User Guide for details:

https://packaging.python.org/specifications/core-metadata/#project-url-multiple-use

Setuptools implementation is underway here:

    https://github.com/pypa/setuptools/pull/1210

Change-Id: I14e580c654b619cab7eb24e31f736056d6cf9bd4
This commit is contained in:
Jeremy Stanley 2017-11-20 18:04:26 +00:00
parent 73cc4189ca
commit 839ef3428d
4 changed files with 22 additions and 0 deletions

View File

@ -52,6 +52,10 @@ itself):
summary = OpenStack's setup automation in a reusable form
description-file = README
home-page = https://launchpad.net/pbr
project_urls =
Bug Tracker = https://bugs.launchpad.net/pbr/
Documentation = https://docs.openstack.org/pbr/
Source Code = https://git.openstack.org/cgit/openstack-dev/pbr/
license = Apache-2
classifier =
Development Status :: 4 - Beta

View File

@ -6,6 +6,10 @@ version = 0.1.dev
author = OpenStack
author-email = openstack-dev@lists.openstack.org
home-page = http://pypi.python.org/pypi/pbr
project_urls =
Bug Tracker = https://bugs.launchpad.net/pbr/
Documentation = https://docs.openstack.org/pbr/
Source Code = https://git.openstack.org/cgit/openstack-dev/pbr/
summary = Test package for testing pbr
description-file =
README.txt

View File

@ -101,6 +101,7 @@ D1_D2_SETUP_ARGS = {
"maintainer": ("metadata",),
"maintainer_email": ("metadata",),
"url": ("metadata", "home_page"),
"project_urls": ("metadata",),
"description": ("metadata", "summary"),
"keywords": ("metadata",),
"long_description": ("metadata", "description"),
@ -148,6 +149,9 @@ MULTI_FIELDS = ("classifiers",
"tests_require",
"cmdclass")
# setup() arguments that can have mapping values in setup.cfg
MAP_FIELDS = ("project_urls",)
# setup() arguments that contain boolean values
BOOL_FIELDS = ("use_2to3", "zip_safe", "include_package_data")
@ -321,6 +325,12 @@ def setup_cfg_to_setup_kwargs(config, script_args=()):
in_cfg_value = split_csv(in_cfg_value)
if arg in MULTI_FIELDS:
in_cfg_value = split_multiline(in_cfg_value)
elif arg in MAP_FIELDS:
in_cfg_map = {}
for i in split_multiline(in_cfg_value):
k, v = i.split('=')
in_cfg_map[k.strip()] = v.strip()
in_cfg_value = in_cfg_map
elif arg in BOOL_FIELDS:
# Provide some flexibility here...
if in_cfg_value.lower() in ('true', 't', '1', 'yes', 'y'):

View File

@ -6,6 +6,10 @@ summary = Python Build Reasonableness
description-file =
README.rst
home-page = https://docs.openstack.org/pbr/latest/
project_urls =
Bug Tracker = https://bugs.launchpad.net/pbr/
Documentation = https://docs.openstack.org/pbr/
Source Code = https://git.openstack.org/cgit/openstack-dev/pbr/
requires-python = >=2.6
classifier =
Development Status :: 5 - Production/Stable