|
|
@ -10,7 +10,7 @@ from subprocess import Popen, PIPE, call, check_call |
|
|
|
|
|
|
|
import yaml |
|
|
|
|
|
|
|
from patacrep import authors, content, errors, encoding, files, pkg_datapath, Rx |
|
|
|
from patacrep import authors, content, errors, encoding, files, pkg_datapath, Rx, utils |
|
|
|
from patacrep.index import process_sxd |
|
|
|
from patacrep.templates import TexBookRenderer |
|
|
|
from patacrep.songs import DataSubpath, DEFAULT_CONFIG |
|
|
@ -338,7 +338,10 @@ def check_config_schema(data): |
|
|
|
rx_checker = Rx.Factory({"register_core_types": True}) |
|
|
|
schema_path = pkg_datapath('templates', 'songbook_schema.yml') |
|
|
|
with encoding.open_read(schema_path) as schema_file: |
|
|
|
schema = rx_checker.make_schema(yaml.load(schema_file)) |
|
|
|
schema_struct = yaml.load(schema_file) |
|
|
|
schema_struct = utils.remove_keys(schema_struct, ['_default', '_description']) |
|
|
|
schema = rx_checker.make_schema(schema_struct) |
|
|
|
|
|
|
|
if schema.check(data): |
|
|
|
return data |
|
|
|
raise errors.SBFileError('The songbook file does not respect the schema') |
|
|
|