Skip to content

Commit

Permalink
Merge pull request #25 from linkml/schemaview
Browse files Browse the repository at this point in the history
New module: schemaview. Dynamic views over schemas
  • Loading branch information
cmungall authored Aug 17, 2021
2 parents d691e1a + b8e25da commit 7533c13
Show file tree
Hide file tree
Showing 9 changed files with 2,504 additions and 0 deletions.
4 changes: 4 additions & 0 deletions linkml_runtime/utils/compile_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,15 @@ def compile_python(text_or_fn: str, package_path: str = None) -> ModuleType:
spec = compile(python_txt, 'test', 'exec')
module = ModuleType('test')
if package_path:
package_path_abs = os.path.join(os.getcwd(), package_path)
# We have to calculate the path to expected path relative to the current working directory
for path in sys.path:
if package_path.startswith(path):
path_from_tests_parent = os.path.relpath(package_path, path)
break
if package_path_abs.startswith(path):
path_from_tests_parent = os.path.relpath(package_path_abs, path)
break
else:
warning(f"There is no established path to {package_path} - compile_python may or may not work")
path_from_tests_parent = os.path.relpath(package_path, os.path.join(os.getcwd(), '..'))
Expand Down
Loading

0 comments on commit 7533c13

Please sign in to comment.