Spaces:
Running
Running
Download scripts/pin_core.py from ejschwartz/decompile-verify: direct link, hf CLI and curl.
- Browser
- Download file 1.46 kB
-
https://huggingface.co/spaces/ejschwartz/decompile-verify/resolve/main/scripts/pin_core.py
- Command line
-
hf download hf://spaces/ejschwartz/decompile-verify/scripts/pin_core.py
-
curl -L -o pin_core.py https://huggingface.co/spaces/ejschwartz/decompile-verify/resolve/main/scripts/pin_core.py
1.46 kB
| """Record the submodule revision and export public-only runtime dependencies.""" | |
| import json | |
| import re | |
| from pathlib import Path | |
| import subprocess | |
| import tomllib | |
| ROOT = Path(__file__).resolve().parents[1] | |
| def main(): | |
| commit = subprocess.check_output(["git", "-C", str(ROOT / "core"), "rev-parse", "HEAD"], text=True).strip() | |
| if subprocess.check_output(["git", "-C", str(ROOT / "core"), "status", "--porcelain"], text=True).strip(): | |
| raise SystemExit("Commit core changes before pinning the submodule.") | |
| subprocess.run(["git", "add", "core"], cwd=ROOT, check=True) | |
| module = tomllib.loads((ROOT / "core/pyproject.toml").read_text()) | |
| data = {"repository": "https://github.com/edmcman/decompile-verify.git", "commit": commit, | |
| "version": module["project"]["version"]} | |
| project = ROOT / "pyproject.toml" | |
| project.write_text(re.sub(r'"decompile-verify==[^" ]+"', | |
| f'"decompile-verify=={data["version"]}"', project.read_text())) | |
| (ROOT / "core-revision.json").write_text(json.dumps(data, indent=2) + "\n") | |
| subprocess.run(["uv", "lock"], cwd=ROOT, check=True) | |
| subprocess.run(["uv", "export", "--locked", "--no-dev", "--group", "bootstrap", | |
| "--no-emit-project", "--no-emit-package", "decompile-verify", | |
| "--output-file", "requirements-runtime.txt"], cwd=ROOT, check=True, stdout=subprocess.DEVNULL) | |
| if __name__ == "__main__": | |
| main() | |