33 lines
1.0 KiB
Python
33 lines
1.0 KiB
Python
from __future__ import annotations
|
|
|
|
import importlib.util
|
|
from pathlib import Path
|
|
from types import ModuleType
|
|
|
|
|
|
def load_backend_script() -> ModuleType:
|
|
script = Path(__file__).resolve().parents[1] / "backend" / "scripts" / "cleanup_demo_artifacts.py"
|
|
spec = importlib.util.spec_from_file_location("backend_cleanup_demo_artifacts", script)
|
|
if spec is None or spec.loader is None:
|
|
raise RuntimeError(f"Could not load cleanup implementation from {script}")
|
|
module = importlib.util.module_from_spec(spec)
|
|
spec.loader.exec_module(module)
|
|
return module
|
|
|
|
|
|
_impl = load_backend_script()
|
|
|
|
DEMO_PROJECT_NAME = _impl.DEMO_PROJECT_NAME
|
|
is_within_storage_root = _impl.is_within_storage_root
|
|
export_created_at = _impl.export_created_at
|
|
select_cleanup_candidates = _impl.select_cleanup_candidates
|
|
export_path = _impl.export_path
|
|
prune_empty_parents = _impl.prune_empty_parents
|
|
cleanup_demo_exports = _impl.cleanup_demo_exports
|
|
build_parser = _impl.build_parser
|
|
main = _impl.main
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|