MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / read_cargo_version

Function read_cargo_version

scripts/prepare-release.py:63–78  ·  view source on GitHub ↗

Read the [package].version field from Cargo.toml.

()

Source from the content-addressed store, hash-verified

61
62
63def read_cargo_version() -> str:
64 """Read the [package].version field from Cargo.toml."""
65 text = CARGO_TOML_PATH.read_text(encoding="utf-8")
66 # Find [package] section then walk to the first `version = "..."`.
67 in_package = False
68 for line in text.splitlines():
69 stripped = line.strip()
70 if stripped.startswith("["):
71 in_package = stripped == "[package]"
72 continue
73 if not in_package:
74 continue
75 m = re.match(r'version\s*=\s*"([^"]+)"', stripped)
76 if m:
77 return m.group(1)
78 raise SystemExit("prepare-release: Cargo.toml [package].version not found")
79
80
81def today_utc_iso() -> str:

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected