aboutsummaryrefslogtreecommitdiff
path: root/src/hydrilla/builder/build.py
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-05-31 16:52:14 +0200
committerWojtek Kosior <koszko@koszko.org>2022-05-31 16:52:14 +0200
commit73a443f518be29a50981e7e137e2b4c2c37552dd (patch)
tree31388ae094278b7284c825a940ab57b5113077be /src/hydrilla/builder/build.py
parent2a22a0c8bb692647798ca3874b1c08533307ed96 (diff)
downloadhydrilla-builder-73a443f518be29a50981e7e137e2b4c2c37552dd.tar.gz
hydrilla-builder-73a443f518be29a50981e7e137e2b4c2c37552dd.zip
improve loading of schema files
Diffstat (limited to 'src/hydrilla/builder/build.py')
-rw-r--r--src/hydrilla/builder/build.py13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/hydrilla/builder/build.py b/src/hydrilla/builder/build.py
index 33838f3..a3c55a7 100644
--- a/src/hydrilla/builder/build.py
+++ b/src/hydrilla/builder/build.py
@@ -51,15 +51,6 @@ here = Path(__file__).resolve().parent
_ = util.translation(here / 'locales').gettext
-def index_validator(major_schema_version):
- """
- Create an index.json schema validator specific to the requested schema
- version series.
- """
- exact_version = {1: '1.0.1', 2: '2'}[major_schema_version]
-
- return util.validator_for(f'package_source-{exact_version}.schema.json')
-
schemas_root = 'https://hydrilla.koszko.org/schemas'
generated_by = {
@@ -365,7 +356,9 @@ class Build:
files and computed definitions of the source package and items defined
in it.
"""
- index_validator(major_schema_version).validate(index_obj)
+ schema_name = f'package_source-{major_schema_version}.schema.json';
+
+ util.validator_for(schema_name).validate(index_obj)
match = re.match(r'.*-((([1-9][0-9]*|0)\.)+)schema\.json$',
index_obj['$schema'])