Skip to content

Commit d466763

Browse files
authored
fix #7666 use feature_config.package_path when looking up sim_apis (#7667)
1 parent c82bde5 commit d466763

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

sirepo/package_data/static/json/cortex-schema.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
2+
"apiRoute": {
3+
"cortexDb": "/cortex-db"
4+
},
25
"appInfo": {
36
"cortex": {
47
"longName": "CORTEX Material Database",

sirepo/package_data/static/json/schema-common.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@
135135
"contentTooLarge": "/content-too-large",
136136
"copyNonSessionSimulation": "/copy-non-session-simulation",
137137
"copySimulation": "/copy-simulation",
138-
"cortexDb": "/cortex-db",
139138
"deleteFile": "/delete-file",
140139
"deleteLibFile": "/delete-lib-file",
141140
"deleteSimulation": "/delete-simulation",

sirepo/simulation_db.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -913,6 +913,7 @@ def _init_schemas():
913913

914914
# TODO(mvk): improve merging common and local schema
915915
_merge_dicts(s.common.dynamicFiles, s.dynamicFiles)
916+
_merge_dicts(s.get("apiRoute", PKDict()), s.route)
916917
s.dynamicModules = _files_in_schema(s.dynamicFiles)
917918
for i in [
918919
"appDefaults",

sirepo/uri_router.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -561,10 +561,15 @@ def _path_to_route(path):
561561

562562

563563
def _register_sim_modules(package, sim_types):
564-
p = pkinspect.module_name_join(("sirepo", package))
565-
for n in pkinspect.package_module_names(p):
566-
if n in sim_types:
567-
register_api_module(pkinspect.module_name_join((p, n)))
564+
def _modules(package_path):
565+
for n in sim_types:
566+
try:
567+
yield pkinspect.import_submodule(n, package, package_path)
568+
except pkinspect.SubmoduleNotFound:
569+
continue
570+
571+
for m in _modules(sirepo.feature_config.cfg().package_path):
572+
register_api_module(m)
568573

569574

570575
def _split_uri(uri):

0 commit comments

Comments
 (0)