diff --git a/capsul/dataset.py b/capsul/dataset.py index 9e7695c61..76a4af2e0 100644 --- a/capsul/dataset.py +++ b/capsul/dataset.py @@ -14,6 +14,7 @@ from pathlib import Path import re import sys +import importlib from capsul.pipeline.pipeline import Process, Pipeline from capsul.pipeline.process_iteration import ProcessIteration @@ -63,7 +64,15 @@ def __init__(self, path=None, metadata_schema=None): @classmethod def find_schema(cls, metadata_schema): - return cls.schemas.get(metadata_schema) + schema = cls.schemas.get(metadata_schema) + if schema is None: + try: + # try to import the schema from capsul.schemas + importlib.import_module(f'capsul.schemas.{metadata_schema}') + except ImportError: + pass # oh well... + schema = cls.schemas.get(metadata_schema) + return schema @classmethod def find_schema_mapping(cls, source_schema, target_schema): diff --git a/capsul/schemas/brainvisa_shared.py b/capsul/schemas/brainvisa_shared.py new file mode 100644 index 000000000..0b0c87b74 --- /dev/null +++ b/capsul/schemas/brainvisa_shared.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- + +# this module just aims to register the brainvisa_share schema when imported +# by Dataset.find_schema() + +from . import brainvisa