This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
def repo_root():
|
||||
current = pathlib.Path(__file__).resolve()
|
||||
for candidate in (current.parent, *current.parents):
|
||||
if (candidate / "modulus.json").is_file():
|
||||
return candidate
|
||||
raise SystemExit("could not find modulus.json from Modulus tool wrapper")
|
||||
|
||||
def run(command):
|
||||
root = repo_root()
|
||||
runtime_root = root / "build" / "build_common" / "modulus"
|
||||
source_root = root / "modulus" / "cli.py"
|
||||
if source_root.is_file():
|
||||
sys.path.insert(0, str(root))
|
||||
elif runtime_root.exists():
|
||||
sys.path.insert(0, str(runtime_root))
|
||||
import modulus.cli
|
||||
raise SystemExit(modulus.cli.main(command))
|
||||
Reference in New Issue
Block a user