From 9a8103dec3853df0b1d3216ab6b3202f3ead3175 Mon Sep 17 00:00:00 2001 From: cmungall Date: Thu, 24 Mar 2022 10:29:21 -0700 Subject: [PATCH] Adding src path to list of paths to search when retrieving a schema by package name. See https://github.com/linkml/linkml-project-template/issues/2 --- linkml_runtime/utils/distroutils.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/linkml_runtime/utils/distroutils.py b/linkml_runtime/utils/distroutils.py index fef05b07..ed679d0e 100644 --- a/linkml_runtime/utils/distroutils.py +++ b/linkml_runtime/utils/distroutils.py @@ -1,3 +1,6 @@ +""" +Packaging for working with LinkML distributions +""" import logging import pkgutil from pathlib import PurePath @@ -14,9 +17,14 @@ def get_default_paths(file_type: str) -> List[PurePath]: """ paths = [] rel_dirs = [] + srcp = PurePath('src') if file_type == 'yaml': rel_dirs = [PurePath('model') /'schema', - PurePath('schema') + PurePath('schema'), + srcp / 'linkml', + srcp / 'model', + srcp / 'model' / 'schema', + srcp / 'schema', ] elif file_type == 'schema.json': rel_dirs = [PurePath('jsonschema')] @@ -52,7 +60,7 @@ def get_packaged_file_as_str(package: str, file_type: str, rel_paths: List[PureP data = pkgutil.get_data(package, str(full_path)) break except FileNotFoundError: - logging.debug(f'{full_path} not found') + logging.debug(f'candidate {path} not found') if not data: raise FileNotFoundError(f'package: {package} file: {file_type}') return data.decode(encoding)