Uncap jsonschema
With the latest upper constraints updating generated patch [1] the
openstack-tox-docs job started to fail, due to conflict:
ERROR: Cannot install jsonschema<4.0.0 and >=3.2.0 because these
package versions have conflicting dependencies.
The conflict is caused by:
The user requested jsonschema<4.0.0 and >=3.2.0
The user requested (constraint) jsonschema===4.7.2
This is because we have jsonschema<4.0.0 in our requirements.txt.
By uncapping the constraint the docs job is passing.
Date validation needed to be updated as well, because a deprecated
usage of validator extending method was used in the code, which was
removed [2] from jsonschema with the 4.0.0 release. This patch replaces
that with adding a TYPE_CHECKER instead.
With the new jsonschema constraint openstack-tox-py36 job does not pass
anymore, but py36 is dropped from zed anyway. That job is pulled in by
an old job template, which needs to be replaced to the new zed job
templates, too.
[1] I89576353371aa87d181610eb6242cbe961487af6
[2] d9f6384060
Closes-Bug: #1982757
Change-Id: Ida6310dd822e587ce9c424a228fdff5192ba0476
This commit is contained in:
parent
5d54e97383
commit
e83bb1f69a
20
.zuul.yaml
20
.zuul.yaml
@ -10,7 +10,7 @@
|
||||
|
||||
- project:
|
||||
templates:
|
||||
- openstack-python3-victoria-jobs
|
||||
- openstack-python3-zed-jobs
|
||||
- build-openstack-docs-pti
|
||||
check:
|
||||
jobs:
|
||||
@ -19,12 +19,17 @@
|
||||
irrelevant-files:
|
||||
- ^doc/.*$
|
||||
- releases-tox-list-changes
|
||||
- openstack-tox-py36:
|
||||
- openstack-tox-py38:
|
||||
irrelevant-files:
|
||||
- ^data/.*$
|
||||
- ^deliverables/.*$
|
||||
- ^doc/.*$
|
||||
- openstack-tox-py37:
|
||||
- openstack-tox-py39:
|
||||
irrelevant-files:
|
||||
- ^data/.*$
|
||||
- ^deliverables/.*$
|
||||
- ^doc/.*$
|
||||
- openstack-tox-py310:
|
||||
irrelevant-files:
|
||||
- ^data/.*$
|
||||
- ^deliverables/.*$
|
||||
@ -46,12 +51,17 @@
|
||||
timeout: 10800
|
||||
irrelevant-files:
|
||||
- ^doc/.*$
|
||||
- openstack-tox-py36:
|
||||
- openstack-tox-py38:
|
||||
irrelevant-files:
|
||||
- ^data/.*$
|
||||
- ^deliverables/.*$
|
||||
- ^doc/.*$
|
||||
- openstack-tox-py37:
|
||||
- openstack-tox-py39:
|
||||
irrelevant-files:
|
||||
- ^data/.*$
|
||||
- ^deliverables/.*$
|
||||
- ^doc/.*$
|
||||
- openstack-tox-py310:
|
||||
irrelevant-files:
|
||||
- ^data/.*$
|
||||
- ^deliverables/.*$
|
||||
|
@ -45,20 +45,20 @@ _LIAISONS_SCHEMA = yamlutils.loads(
|
||||
)
|
||||
|
||||
|
||||
def is_date(validator, value, instance, schema):
|
||||
if not isinstance(instance, str):
|
||||
return
|
||||
try:
|
||||
return datetime.datetime.strptime(instance, "%Y-%m-%d")
|
||||
except Exception:
|
||||
yield jsonschema.ValidationError('Invalid date {!r}'.format(instance))
|
||||
def is_date(validator, instance):
|
||||
return (
|
||||
isinstance(instance, datetime.date) and
|
||||
not isinstance(instance, datetime.datetime)
|
||||
)
|
||||
|
||||
|
||||
def make_validator_with_date(schema_data):
|
||||
draft4_validator = jsonschema.Draft4Validator
|
||||
date_type_checker = draft4_validator.TYPE_CHECKER.redefine("date", is_date)
|
||||
return jsonschema.validators.extend(
|
||||
validator=jsonschema.Draft4Validator(schema_data),
|
||||
validators={'date': is_date},
|
||||
)(schema_data, types={'date': datetime.date})
|
||||
validator=draft4_validator,
|
||||
type_checker=date_type_checker
|
||||
)(schema=schema_data)
|
||||
|
||||
|
||||
def validate_one_file(filename, schema_data, debug):
|
||||
|
@ -17,7 +17,7 @@ yamlordereddictloader
|
||||
prompt_toolkit>=2.0.7
|
||||
tqdm
|
||||
mwclient==0.8.1
|
||||
jsonschema<4.0.0,>=3.2.0
|
||||
jsonschema>=3.2.0
|
||||
twine>=1.13.0
|
||||
wheel>=0.34.2
|
||||
ruamel.yaml>=0.15
|
||||
|
Loading…
Reference in New Issue
Block a user