From df026b92400848d6a701a5cbdf80b46e6568f5d4 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Wed, 26 Aug 2026 22:16:44 +0200 Subject: [PATCH] fix: produce correct wheel metadata all published deltachat-rpc-server wheels so far fail "wheel tags" and probably other tools. Translate "dev" cargo-versioning to PEP440-versioning to make CI dev wheel builds reproducable at least for the 11 non-mac targets. --- .github/workflows/deltachat-rpc-server.yml | 8 ++++++++ scripts/wheel-rpc-server.py | 18 ++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deltachat-rpc-server.yml b/.github/workflows/deltachat-rpc-server.yml index 8a59a4c117..50a5a737f4 100644 --- a/.github/workflows/deltachat-rpc-server.yml +++ b/.github/workflows/deltachat-rpc-server.yml @@ -370,6 +370,14 @@ jobs: - name: List artifacts run: ls -l dist/ + - name: Check that the wheel metadata reads back + run: | + echo 'You can check a local `nix build` on non-Mac machines against the following checksums.' + sha256sum dist/*.whl + mkdir tagcheck + cp dist/*.whl tagcheck/ + nix run --inputs-from . nixpkgs#python3Packages.wheel -- tags tagcheck/*.whl + - name: Upload binaries to the GitHub release if: github.event_name == 'release' env: diff --git a/scripts/wheel-rpc-server.py b/scripts/wheel-rpc-server.py index 973dd853e9..8f5c8d8059 100755 --- a/scripts/wheel-rpc-server.py +++ b/scripts/wheel-rpc-server.py @@ -20,6 +20,16 @@ def metadata_contents(version): """ +def wheel_contents(tag): + """Render the WHEEL metadata for a filename tag.""" + interpreter, abi, platforms = tag.split("-") + lines = ["Wheel-Version: 1.0", "Root-Is-Purelib: false"] + lines += [ + f"Tag: {interpreter}-{abi}-{platform}" for platform in platforms.split(".") + ] + return "\n".join(lines) + "\n" + + def build_wheel(version, binary, tag, windows=False): filename = f"deltachat_rpc_server-{version}-{tag}.whl" @@ -60,7 +70,7 @@ def main(): ) wheel.writestr( f"deltachat_rpc_server-{version}.dist-info/WHEEL", - "Wheel-Version: 1.0\nRoot-Is-Purelib: false\nTag: {tag}", + wheel_contents(tag), ) wheel.writestr( f"deltachat_rpc_server-{version}.dist-info/entry_points.txt", @@ -87,7 +97,11 @@ def main(): def main(): with Path("Cargo.toml").open("rb") as fp: cargo_manifest = tomllib.load(fp) - version = cargo_manifest["package"]["version"] + + # Cargo's SEMVER "-dev" suffix is not a PEP 440 version, + # so translate to make wheel tooling and metadata writing happy. + version = cargo_manifest["package"]["version"].replace("-dev", ".dev0") + arch = sys.argv[1] executable = sys.argv[2] tags = arch2tags[arch]