From 8bd1c6510d070840fa928339d0365239ab8d82e4 Mon Sep 17 00:00:00 2001 From: Laurie O Date: Mon, 21 Sep 2020 16:51:49 +0000 Subject: [PATCH] PEP 633: Reference implementation fixes (#1608) --- pep-0633.rst | 62 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 23 deletions(-) diff --git a/pep-0633.rst b/pep-0633.rst index 9ffbcad74..1f1720718 100644 --- a/pep-0633.rst +++ b/pep-0633.rst @@ -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": {