Commit 159123f3 by Brian Turek Committed by Steph Samson

Add support for maintainers setting in pyproject.toml (#1175)

parent 964d004b
......@@ -46,6 +46,12 @@ The authors of the package. **Required**
This is a list of authors and should contain at least one author. Authors must be in the form `name <email>`.
## maintainers
The maintainers of the package. **Optional**
This is a list of maintainers and should be distinct from authors. Maintainers may contain an email and be in the form `name <email>`.
## readme
The readme file of the package. **Optional**
......
......@@ -50,6 +50,9 @@
"authors": {
"$ref": "#/definitions/authors"
},
"maintainers": {
"$ref": "#/definitions/maintainers"
},
"readme": {
"type": "string",
"description": "The path to the README file"
......@@ -180,6 +183,13 @@
"type": "string"
}
},
"maintainers": {
"type": "array",
"description": "List of maintainers, other than the original author(s), that upkeep the package.",
"items": {
"type": "string"
}
},
"dependencies": {
"type": "object",
"patternProperties": {
......
......@@ -178,6 +178,14 @@ class Builder(object):
if self._meta.author_email:
content += "Author-email: {}\n".format(to_str(self._meta.author_email))
if self._meta.maintainer:
content += "Maintainer: {}\n".format(to_str(self._meta.maintainer))
if self._meta.maintainer_email:
content += "Maintainer-email: {}\n".format(
to_str(self._meta.maintainer_email)
)
if self._meta.requires_python:
content += "Requires-Python: {}\n".format(self._meta.requires_python)
......
......@@ -32,6 +32,8 @@ setup_kwargs = {{
'long_description': {long_description!r},
'author': {author!r},
'author_email': {author_email!r},
'maintainer': {maintainer!r},
'maintainer_email': {maintainer_email!r},
'url': {url!r},
{extra}
}}
......@@ -180,6 +182,8 @@ class SdistBuilder(Builder):
long_description=to_str(self._meta.description),
author=to_str(self._meta.author),
author_email=to_str(self._meta.author_email),
maintainer=to_str(self._meta.maintainer),
maintainer_email=to_str(self._meta.maintainer_email),
url=to_str(self._meta.home_page),
extra="\n ".join(extra),
after="\n".join(after),
......
......@@ -60,8 +60,8 @@ class Metadata:
meta.classifiers = package.all_classifiers
# Version 1.2
meta.maintainer = meta.author
meta.maintainer_email = meta.author_email
meta.maintainer = package.maintainer_name
meta.maintainer_email = package.maintainer_email
# Requires python
if package.python_versions != "*":
......
......@@ -46,6 +46,7 @@ class Package(object):
self.description = ""
self._authors = []
self._maintainers = []
self.homepage = None
self.repository_url = None
......@@ -135,6 +136,18 @@ class Package(object):
return self._get_author()["email"]
@property
def maintainers(self): # type: () -> list
return self._maintainers
@property
def maintainer_name(self): # type: () -> str
return self._get_maintainer()["name"]
@property
def maintainer_email(self): # type: () -> str
return self._get_maintainer()["email"]
@property
def all_requires(self):
return self.requires + self.dev_requires
......@@ -149,6 +162,17 @@ class Package(object):
return {"name": name, "email": email}
def _get_maintainer(self): # type: () -> dict
if not self._maintainers:
return {"name": None, "email": None}
m = AUTHOR_REGEX.match(self._maintainers[0])
name = m.group("name")
email = m.group("email")
return {"name": name, "email": email}
@property
def python_versions(self):
return self._python_versions
......
......@@ -113,6 +113,9 @@ class Poetry:
for author in local_config["authors"]:
package.authors.append(author)
for maintainer in local_config.get("maintainers", []):
package.maintainers.append(maintainer)
package.description = local_config.get("description", "")
package.homepage = local_config.get("homepage")
package.repository_url = local_config.get("repository")
......
......@@ -5,6 +5,9 @@ description = "Some description."
authors = [
"Sébastien Eustace <sebastien@eustace.io>"
]
maintainers = [
"People Everywhere <people@everywhere.com>"
]
license = "MIT"
readme = "README.rst"
......
......@@ -209,6 +209,8 @@ License: MIT
Keywords: packaging,dependency,poetry
Author: Sébastien Eustace
Author-email: sebastien@eustace.io
Maintainer: People Everywhere
Maintainer-email: people@everywhere.com
Requires-Python: >=3.6,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
......@@ -309,6 +311,8 @@ License: MIT
Keywords: packaging,dependency,poetry
Author: Sébastien Eustace
Author-email: sebastien@eustace.io
Maintainer: People Everywhere
Maintainer-email: people@everywhere.com
Requires-Python: >=3.6,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
......
......@@ -87,6 +87,8 @@ License: MIT
Keywords: packaging,dependency,poetry
Author: Sébastien Eustace
Author-email: sebastien@eustace.io
Maintainer: People Everywhere
Maintainer-email: people@everywhere.com
Requires-Python: >=3.6,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
......
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