43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
"""Stage a tiny workspace and pass it to the Windows AppContainer probe."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
REPOSITORY = Path(__file__).resolve().parents[1]
|
|
sys.path.insert(0, str(REPOSITORY))
|
|
|
|
from app.execution_snapshot import stage_selected_files
|
|
|
|
|
|
def main() -> int:
|
|
if len(sys.argv) != 2:
|
|
print("usage: run_appcontainer_probe.py <probe-executable>", file=sys.stderr)
|
|
return 2
|
|
repository = REPOSITORY
|
|
os.environ["SOVEREIGNAI_ALLOWED_WORKSPACES"] = str(repository)
|
|
os.environ["SOVEREIGNAI_WORKSPACE"] = str(repository)
|
|
files = [
|
|
"README.md",
|
|
"scripts/appcontainer_user_code_smoke.py",
|
|
"scripts/appcontainer_disk_fill_smoke.py",
|
|
]
|
|
with stage_selected_files(repository, files) as snapshot:
|
|
environment = os.environ.copy()
|
|
environment["SOVEREIGNAI_STAGING_ROOT"] = str(snapshot.root)
|
|
environment["SOVEREIGNAI_ENTRY_SCRIPT"] = "scripts/appcontainer_user_code_smoke.py"
|
|
completed = subprocess.run(
|
|
[str(Path(sys.argv[1]).resolve(strict=True))],
|
|
cwd=repository,
|
|
env=environment,
|
|
check=False,
|
|
)
|
|
return completed.returncode
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|