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