fix: 移除 sage 引用,改为通用 APP_ROOT
This commit is contained in:
parent
50a38e15e1
commit
a7a44eda11
@ -7,24 +7,22 @@ import subprocess
|
|||||||
|
|
||||||
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
||||||
# Find Sage root
|
# Find app root (pipeline-app or any ahserver app)
|
||||||
SAGE_ROOT = None
|
APP_ROOT = None
|
||||||
for candidate in [
|
for candidate in [
|
||||||
os.path.join(SCRIPT_DIR, "..", ".."),
|
os.path.join(SCRIPT_DIR, "..", ".."),
|
||||||
os.path.expanduser("~/repos/sage"),
|
|
||||||
os.path.expanduser("~/sage"),
|
|
||||||
os.path.expanduser("~/test/pipeline-app"),
|
os.path.expanduser("~/test/pipeline-app"),
|
||||||
]:
|
]:
|
||||||
if os.path.isdir(os.path.join(candidate, "wwwroot")) and os.path.isdir(os.path.join(candidate, "py3")):
|
if os.path.isdir(os.path.join(candidate, "wwwroot")) and os.path.isdir(os.path.join(candidate, "py3")):
|
||||||
SAGE_ROOT = os.path.abspath(candidate)
|
APP_ROOT = os.path.abspath(candidate)
|
||||||
break
|
break
|
||||||
|
|
||||||
if not SAGE_ROOT:
|
if not APP_ROOT:
|
||||||
print("ERROR: Cannot find Sage/pipeline-app root directory")
|
print("ERROR: Cannot find app root directory")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
SET_ROLE_PERM = os.path.join(SAGE_ROOT, "set_role_perm.py")
|
SET_ROLE_PERM = os.path.join(APP_ROOT, "set_role_perm.py")
|
||||||
PYTHON = os.path.join(SAGE_ROOT, "py3", "bin", "python")
|
PYTHON = os.path.join(APP_ROOT, "py3", "bin", "python")
|
||||||
|
|
||||||
MOD = "pipeline_task"
|
MOD = "pipeline_task"
|
||||||
|
|
||||||
@ -48,16 +46,16 @@ PATHS_ANY = [
|
|||||||
|
|
||||||
def register_paths():
|
def register_paths():
|
||||||
for path in PATHS_ANY:
|
for path in PATHS_ANY:
|
||||||
subprocess.run([PYTHON, SET_ROLE_PERM, "any", path], cwd=SAGE_ROOT)
|
subprocess.run([PYTHON, SET_ROLE_PERM, "any", path], cwd=APP_ROOT)
|
||||||
print(f" any: {path}")
|
print(f" any: {path}")
|
||||||
|
|
||||||
for path in PATHS_LOGINED:
|
for path in PATHS_LOGINED:
|
||||||
subprocess.run([PYTHON, SET_ROLE_PERM, "logined", path], cwd=SAGE_ROOT)
|
subprocess.run([PYTHON, SET_ROLE_PERM, "logined", path], cwd=APP_ROOT)
|
||||||
print(f" logined: {path}")
|
print(f" logined: {path}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
print(f"=== pipeline_task RBAC registration ===")
|
print(f"=== pipeline_task RBAC registration ===")
|
||||||
print(f"Root: {SAGE_ROOT}")
|
print(f"App root: {APP_ROOT}")
|
||||||
register_paths()
|
register_paths()
|
||||||
print("Done.")
|
print("Done.")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user