chore: import upstream snapshot with attribution
CI: cua-driver distro-compat matrix / debian:12 (glibc 2.36) (push) Has been cancelled
CI: SPDX Headers / Check SPDX headers (warn-only) (push) Has been cancelled
CD: Docs MCP Server / build (linux/amd64) (push) Has been cancelled
CD: Docs MCP Server / build (linux/arm64) (push) Has been cancelled
CD: Docs MCP Server / merge (push) Has been cancelled
CI: cua-driver distro-compat matrix / Resolve release version (push) Has been cancelled
CI: cua-driver distro-compat matrix / fedora:41 (glibc 2.40) (push) Has been cancelled
CI: cua-driver distro-compat matrix / rockylinux:9 (glibc 2.34) (push) Has been cancelled
CI: cua-driver distro-compat matrix / ubuntu:22.04 (glibc 2.35) (push) Has been cancelled
CI: cua-driver distro-compat matrix / ubuntu:24.04 (glibc 2.39) (push) Has been cancelled
CI: cua-driver distro-compat matrix / Distro compat summary (push) Has been cancelled
CI: Rust Linux unit / Rust Linux unit and compile (push) Has been cancelled
CI: Rust Windows unit / Rust Windows unit and compile (push) Has been cancelled
CI: Nix Linux Rust source / Nix / compositor build (push) Has been cancelled
CI: Nix Linux Rust source / Nix / driver package (push) Has been cancelled
CI: Nix Linux Rust source / Nix / Rust unit tests (push) Has been cancelled
CI: cua-driver distro-compat matrix / debian:12 (glibc 2.36) (push) Has been cancelled
CI: SPDX Headers / Check SPDX headers (warn-only) (push) Has been cancelled
CD: Docs MCP Server / build (linux/amd64) (push) Has been cancelled
CD: Docs MCP Server / build (linux/arm64) (push) Has been cancelled
CD: Docs MCP Server / merge (push) Has been cancelled
CI: cua-driver distro-compat matrix / Resolve release version (push) Has been cancelled
CI: cua-driver distro-compat matrix / fedora:41 (glibc 2.40) (push) Has been cancelled
CI: cua-driver distro-compat matrix / rockylinux:9 (glibc 2.34) (push) Has been cancelled
CI: cua-driver distro-compat matrix / ubuntu:22.04 (glibc 2.35) (push) Has been cancelled
CI: cua-driver distro-compat matrix / ubuntu:24.04 (glibc 2.39) (push) Has been cancelled
CI: cua-driver distro-compat matrix / Distro compat summary (push) Has been cancelled
CI: Rust Linux unit / Rust Linux unit and compile (push) Has been cancelled
CI: Rust Windows unit / Rust Windows unit and compile (push) Has been cancelled
CI: Nix Linux Rust source / Nix / compositor build (push) Has been cancelled
CI: Nix Linux Rust source / Nix / driver package (push) Has been cancelled
CI: Nix Linux Rust source / Nix / Rust unit tests (push) Has been cancelled
This commit is contained in:
Executable
+78
@@ -0,0 +1,78 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Verifies that the version in pyproject.toml matches the expected version.
|
||||
|
||||
Usage:
|
||||
python get_pyproject_version.py <pyproject_path> <expected_version>
|
||||
|
||||
Exit codes:
|
||||
0 - Versions match
|
||||
1 - Versions don't match or error occurred
|
||||
"""
|
||||
|
||||
import sys
|
||||
|
||||
try:
|
||||
import tomllib
|
||||
except ImportError:
|
||||
# Fallback for Python < 3.11
|
||||
import toml as tomllib
|
||||
|
||||
|
||||
def main():
|
||||
if len(sys.argv) != 3:
|
||||
print(
|
||||
"Usage: python get_pyproject_version.py <pyproject_path> <expected_version>",
|
||||
file=sys.stderr,
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
pyproject_path = sys.argv[1]
|
||||
expected_version = sys.argv[2]
|
||||
|
||||
# tomllib requires binary mode
|
||||
try:
|
||||
with open(pyproject_path, "rb") as f:
|
||||
data = tomllib.load(f)
|
||||
except FileNotFoundError:
|
||||
print(f"❌ ERROR: File not found: {pyproject_path}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
except Exception as e:
|
||||
# Fallback to toml if using the old library or handle other errors
|
||||
try:
|
||||
import toml
|
||||
|
||||
data = toml.load(pyproject_path)
|
||||
except FileNotFoundError:
|
||||
print(f"❌ ERROR: File not found: {pyproject_path}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
except Exception as toml_err:
|
||||
print(f"❌ ERROR: Failed to parse TOML file: {e}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
actual_version = data.get("project", {}).get("version")
|
||||
|
||||
if not actual_version:
|
||||
print("❌ ERROR: No version found in pyproject.toml", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
if actual_version != expected_version:
|
||||
print("❌ Version mismatch detected!", file=sys.stderr)
|
||||
print(f" pyproject.toml version: {actual_version}", file=sys.stderr)
|
||||
print(f" Expected version: {expected_version}", file=sys.stderr)
|
||||
print("", file=sys.stderr)
|
||||
print(
|
||||
"The version in pyproject.toml must match the version being published.", file=sys.stderr
|
||||
)
|
||||
print(
|
||||
f"Please update pyproject.toml to version {expected_version} or use the correct tag.",
|
||||
file=sys.stderr,
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
print(f"✅ Version consistency check passed: {actual_version}")
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user