Reorganize repository into pc web shared monorepo
Separate the local recognition, web publishing, and shared data paths while preserving direct script execution and existing site content. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
"""Launch OSS upload as a detached process inheriting current env (keyzoo inject)."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
WEB_DIR = Path(__file__).resolve().parent
|
||||
LOG = ROOT / "oss_upload.log"
|
||||
ERR = ROOT / "oss_upload_err.log"
|
||||
PID = ROOT / "oss_upload.pid"
|
||||
|
||||
|
||||
def main() -> None:
|
||||
if not os.environ.get("KEYZOO_ASSET_SECRET_ACCESSKEY_SECRET") and not os.environ.get(
|
||||
"OSS_ACCESS_KEY_SECRET"
|
||||
):
|
||||
raise SystemExit("missing AccessKey secret in env")
|
||||
# Clear previous logs.
|
||||
for p in (LOG, ERR):
|
||||
if p.exists():
|
||||
p.unlink()
|
||||
creationflags = 0
|
||||
if sys.platform == "win32":
|
||||
creationflags = subprocess.CREATE_NEW_PROCESS_GROUP | subprocess.DETACHED_PROCESS
|
||||
out = open(LOG, "w", encoding="utf-8")
|
||||
err = open(ERR, "w", encoding="utf-8")
|
||||
proc = subprocess.Popen(
|
||||
[sys.executable, str(WEB_DIR / "_oss_ability_videos.py"), "upload"],
|
||||
cwd=str(ROOT),
|
||||
stdout=out,
|
||||
stderr=err,
|
||||
env=os.environ.copy(),
|
||||
creationflags=creationflags,
|
||||
close_fds=True,
|
||||
)
|
||||
PID.write_text(str(proc.pid), encoding="utf-8")
|
||||
print(f"started_pid={proc.pid}")
|
||||
print(f"log={LOG}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user