-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall
More file actions
executable file
·61 lines (46 loc) · 1.63 KB
/
Copy pathinstall
File metadata and controls
executable file
·61 lines (46 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.11"
# ///
"""Local bootstrap.
Verifies the toolchain shape this repo expects:
- `uv` is on PATH (the only Python entry point).
- The pinned Rust toolchain (rust-toolchain.toml) is resolvable.
- The dev dependency group is materialized.
Does NOT trigger a maturin build — that's reserved for `./test` /
`./build`. Use `./install` after a fresh clone to confirm the
environment is sane.
"""
from __future__ import annotations
import shutil
import subprocess
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parent
def _check(cmd: list[str], label: str) -> int:
print(f" {label:14} ...", end=" ", flush=True)
proc = subprocess.run(cmd, cwd=ROOT, capture_output=True, text=True, check=False)
if proc.returncode != 0:
print("FAIL")
sys.stderr.write(proc.stderr)
return proc.returncode
print("ok")
return 0
def main() -> int:
print(f"bootstrap {ROOT.name}")
if shutil.which("uv") is None:
print("uv not on PATH. Install it: https://docs.astral.sh/uv/", file=sys.stderr)
return 1
rc = 0
rc |= _check(["uv", "--version"], "uv")
rc |= _check(["uv", "sync", "--frozen", "--no-install-project"], "uv sync")
rc |= _check(["rustup", "show", "active-toolchain"], "rustup")
if rc != 0:
return rc
print("\nNext steps:")
print(" ./ci.sh all # run every gate")
print(" ./test # cargo test + maturin develop + pytest")
print(" ./ci.sh --list # show registered gates")
return 0
if __name__ == "__main__":
raise SystemExit(main())