From c6ec0d67e76b70cd6414e804996d3261d7ce379a Mon Sep 17 00:00:00 2001 From: Nicolas van Kempen Date: Fri, 10 May 2024 01:23:18 +0000 Subject: [PATCH] Fix dependency ordering --- .github/workflows/release.yml | 2 +- rust-support/chatdbg/Cargo.toml | 4 ++-- rust-support/chatdbg_macros/Cargo.toml | 2 +- rust-support/fill-crate-version.py | 10 ++++------ 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0d4db73..a300045 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,8 +36,8 @@ jobs: - name: Publish to crates.io run: | cargo login ${{ secrets.CRATES_IO_API_TOKEN }} - cargo publish -p chatdbg --allow-dirty cargo publish -p chatdbg_macros --allow-dirty + cargo publish -p chatdbg --allow-dirty working-directory: rust-support - name: Publish to PyPI diff --git a/rust-support/chatdbg/Cargo.toml b/rust-support/chatdbg/Cargo.toml index 1b380c6..361503f 100644 --- a/rust-support/chatdbg/Cargo.toml +++ b/rust-support/chatdbg/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "chatdbg" -version = "0.0.0" # Sync with pyproject.toml on release. +version = "##VERSION##" # Sync with pyproject.toml on release. edition = "2021" description = "Rust-specific support for ChatDBG." authors = ["Emery Berger "] @@ -10,5 +10,5 @@ homepage = "https://github.com/plasma-umass/ChatDBG/" repository = "https://github.com/plasma-umass/ChatDBG/" [dependencies] -chatdbg_macros = { path = "../chatdbg_macros" } +chatdbg_macros = "##VERSION##" # Sync with pyproject.toml on release. lazy_static = "1.4.0" diff --git a/rust-support/chatdbg_macros/Cargo.toml b/rust-support/chatdbg_macros/Cargo.toml index d9697cc..ba01abb 100644 --- a/rust-support/chatdbg_macros/Cargo.toml +++ b/rust-support/chatdbg_macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "chatdbg_macros" -version = "0.0.0" # Sync with pyproject.toml on release. +version = "##VERSION##" # Sync with pyproject.toml on release. edition = "2021" description = "Rust-specific (macro) support for ChatDBG." authors = ["Noah Lev Bartell-Mangel "] diff --git a/rust-support/fill-crate-version.py b/rust-support/fill-crate-version.py index 6288c59..7740936 100644 --- a/rust-support/fill-crate-version.py +++ b/rust-support/fill-crate-version.py @@ -1,5 +1,6 @@ import os import tomllib +import re DIRNAME = os.path.dirname(__file__) PYPROJECT_FILE = os.path.join(DIRNAME, "../pyproject.toml") @@ -14,10 +15,7 @@ version = tomllib.load(f)["project"]["version"] for file in CARGO_TOML_FILES: with open(file, "r") as f: - lines = f.readlines() + content = f.read() + content = re.sub(r"##VERSION##", version, content) with open(file, "w") as f: - for line in lines: - if line.startswith("version"): - f.write(f'version = "{version}"\n') - else: - f.write(line) + f.write(content)