PEP 633: Reference implementation fixes (#1608)

This commit is contained in:
Laurie O 2020-09-21 16:51:49 +00:00 committed by GitHub
parent e8d68f32b4
commit 8bd1c6510d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 39 additions and 23 deletions

View File

@ -183,9 +183,9 @@ performed):
pep508 += " @ " + requirement["url"]
for vcs in ("git", "hg", "bzr", "svn"):
if vcs in requirement:
pep508 += " @ " + vcs + "+" requirement[vcs]
pep508 += " @ " + vcs + "+" + requirement[vcs]
if "revision" in requirement:
pep508 += "@" + revision
pep508 += "@" + requirement["revision"]
extra = None
if "for-extra" in requirement:
extra = requirement["for-extra"]
@ -199,19 +199,19 @@ performed):
def convert_requirements_to_pep508(dependencies):
pep508s = []
extras = []
extras = set()
for name, req in dependencies.items():
if isinstance(req, list):
for sub_req in req:
pep508, extra = convert_requirement_to_pep508(name, sub_req)
pep508s.append(pep508)
if extra:
extras.append(extra)
extras.add(extra)
else:
pep508, extra = convert_requirement_to_pep508(name, sub_req)
pep508, extra = convert_requirement_to_pep508(name, req)
pep508s.append(pep508)
if extra:
extras.append(extra)
extras.add(extra)
return pep508s, extras
@ -233,7 +233,7 @@ validation errors as users are building the dependencies list.
.. code-block::
{
"$id": "http://sitesee.com.au/schemas/equipment/v3.json",
"$id": "spam",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Project metadata",
"type": "object",
@ -255,6 +255,19 @@ validation errors as users are building the dependencies list.
"type": "string"
}
},
"propertyNames": {
"enum": [
"extras",
"markers",
"version",
"url",
"git",
"hg",
"bzr",
"svn",
"for-extra"
]
},
"oneOf": [
{
"title": "Version requirement",
@ -366,24 +379,11 @@ validation errors as users are building the dependencies list.
}
]
},
"optionalRequirement": {
"title": "Project optional dependency specification",
"optionalRequirementTable": {
"title": "Project optional dependency specification table",
"allOf": [
{
"title": "Base requirement",
"oneOf": [
{
"$ref": "#/definitions/requirementTable"
},
{
"title": "Multiple specifications",
"type": "array",
"items": {
"$ref": "#/definitions/requirementTable"
},
"minLength": 1
}
]
"$ref": "#/definitions/requirementTable"
},
{
"properties": {
@ -397,6 +397,22 @@ validation errors as users are building the dependencies list.
]
}
]
},
"optionalRequirement": {
"title": "Project optional dependency specification",
"oneOf": [
{
"$ref": "#/definitions/optionalRequirementTable"
},
{
"title": "Multiple specifications",
"type": "array",
"items": {
"$ref": "#/definitions/optionalRequirementTable"
},
"minLength": 1
}
]
}
},
"properties": {