Skip to content

Commit

Permalink
Adding src path to list of paths to search when retrieving a schema b…
Browse files Browse the repository at this point in the history
…y package name.

See linkml/linkml-project-template#2
  • Loading branch information
cmungall committed Mar 24, 2022
1 parent ed42ba5 commit 9a8103d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions linkml_runtime/utils/distroutils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
"""
Packaging for working with LinkML distributions
"""
import logging
import pkgutil
from pathlib import PurePath
Expand All @@ -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')]
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 9a8103d

Please sign in to comment.