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__))
|
||||
|
||||
# Find Sage root
|
||||
SAGE_ROOT = None
|
||||
# Find app root (pipeline-app or any ahserver app)
|
||||
APP_ROOT = None
|
||||
for candidate in [
|
||||
os.path.join(SCRIPT_DIR, "..", ".."),
|
||||
os.path.expanduser("~/repos/sage"),
|
||||
os.path.expanduser("~/sage"),
|
||||
os.path.expanduser("~/test/pipeline-app"),
|
||||
]:
|
||||
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
|
||||
|
||||
if not SAGE_ROOT:
|
||||
print("ERROR: Cannot find Sage/pipeline-app root directory")
|
||||
if not APP_ROOT:
|
||||
print("ERROR: Cannot find app root directory")
|
||||
sys.exit(1)
|
||||
|
||||
SET_ROLE_PERM = os.path.join(SAGE_ROOT, "set_role_perm.py")
|
||||
PYTHON = os.path.join(SAGE_ROOT, "py3", "bin", "python")
|
||||
SET_ROLE_PERM = os.path.join(APP_ROOT, "set_role_perm.py")
|
||||
PYTHON = os.path.join(APP_ROOT, "py3", "bin", "python")
|
||||
|
||||
MOD = "pipeline_task"
|
||||
|
||||
@ -48,16 +46,16 @@ PATHS_ANY = [
|
||||
|
||||
def register_paths():
|
||||
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}")
|
||||
|
||||
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}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(f"=== pipeline_task RBAC registration ===")
|
||||
print(f"Root: {SAGE_ROOT}")
|
||||
print(f"App root: {APP_ROOT}")
|
||||
register_paths()
|
||||
print("Done.")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user