From 4db7f58ca27d01a9eba5ccdf56feef9c40d47c79 Mon Sep 17 00:00:00 2001 From: ldm0 Date: Mon, 17 Aug 2026 15:49:56 +0800 Subject: [PATCH] fix(release): restore bookworm build environment --- .github/workflows/release.yml | 2 +- scripts/release.py | 44 +++++++---------------------------- 2 files changed, 10 insertions(+), 36 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 987ed09551..e30740ee59 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -94,7 +94,7 @@ jobs: runner: ubuntu-24.04-arm target: aarch64-unknown-linux-gnu artifact: release-linux-aarch64 - container: rust:1.96.1-bullseye + container: rust:1.96.1-bookworm steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 diff --git a/scripts/release.py b/scripts/release.py index b4e7a57c7e..5f0eec27c5 100755 --- a/scripts/release.py +++ b/scripts/release.py @@ -4,7 +4,6 @@ from __future__ import annotations import argparse -import json import os import re import shlex @@ -13,6 +12,7 @@ import subprocess import sys import tarfile import tempfile +import tomllib import zipfile from pathlib import Path from typing import Sequence @@ -72,41 +72,15 @@ def normalize_version(raw_version: str) -> str: def manifest_version() -> str: - output = run_checked( - [ - "cargo", - "metadata", - "--format-version", - "1", - "--no-deps", - "--manifest-path", - str(MANIFEST_PATH), - ], - capture_output=True, - ).stdout + with MANIFEST_PATH.open("rb") as manifest_file: + manifest = tomllib.load(manifest_file) try: - metadata = json.loads(output) - except json.JSONDecodeError as error: - raise ReleaseError("cargo metadata returned an invalid package list") from error - packages = metadata.get("packages") if isinstance(metadata, dict) else None - if not isinstance(packages, list): - raise ReleaseError("cargo metadata returned an invalid package list") - - for package in packages: - if not isinstance(package, dict): - continue - if package.get("name") != "moli": - continue - manifest_path = package.get("manifest_path") - version = package.get("version") - if ( - isinstance(manifest_path, str) - and Path(manifest_path).resolve() == MANIFEST_PATH - and isinstance(version, str) - ): - return version - - raise ReleaseError(f"package.version is missing from {MANIFEST_PATH}") + value = manifest["package"]["version"] + except (KeyError, TypeError) as error: + raise ReleaseError(f"package.version is missing from {MANIFEST_PATH}") from error + if not isinstance(value, str): + raise ReleaseError(f"package.version in {MANIFEST_PATH} is not a string") + return value def rust_host_target() -> str: