16 lines
481 B
Python
Executable File
16 lines
481 B
Python
Executable File
#!/usr/bin/env python3
|
|
"""Read the canonical RustProxy release version from Cargo.toml."""
|
|
from pathlib import Path
|
|
import sys
|
|
import tomllib
|
|
|
|
|
|
def project_version(root: Path | None = None) -> str:
|
|
manifest = (root or Path(__file__).resolve().parents[1]) / "Cargo.toml"
|
|
data = tomllib.loads(manifest.read_text(encoding="utf-8"))
|
|
return data["package"]["version"]
|
|
|
|
|
|
if __name__ == "__main__":
|
|
print(project_version(Path(sys.argv[1]) if len(sys.argv) > 1 else None))
|