From 837898fc61414f92bfd3d160bf3dc109be9b785d Mon Sep 17 00:00:00 2001 From: tkucar Date: Wed, 12 Mar 2025 17:22:05 +0100 Subject: [PATCH 1/2] cc fix --- CONTRIBUTING.md | 2 +- hatch.toml | 5 +++++ scripts/install-deps.sh | 7 +++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7417db81e..a4ba25e44 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -39,7 +39,7 @@ uv sync --dev > [!TIP] > > - If sync fails with `missing field 'version'`, you may need to delete lockfile and rerun `rm uv.lock && uv sync --dev`. -> - If sync fails with failed compilation, you may need to install clang and rerun `uv sync --dev`. +> - If sync fails with failed compilation, you may need to install dependencies (see [install-deps.sh](scripts/install-deps.sh)) and rerun `uv sync --dev`. ### Running Tests diff --git a/hatch.toml b/hatch.toml index 118b460e5..0421d50b3 100644 --- a/hatch.toml +++ b/hatch.toml @@ -6,6 +6,7 @@ version-file = "src/codegen/sdk/__init__.py" allow-direct-references = true [envs.hatch-build] installer = "uv" + [[envs.hatch-build.matrix]] tool = ["uv", "pip"] @@ -36,6 +37,10 @@ compile_args = [ "darwin", ], arch = "arm64", arg = "-mcpu=apple-m1" }, ] +env = [ + { env = "CC", arg = "cc", platforms = ["linux"] }, + { env = "CC", arg = "clang", platforms = ["darwin"] } +] cythonize_kwargs = { annotate = true, nthreads = 16, exclude_failures = false, cache = true } compiled_sdist = true compile_py = false diff --git a/scripts/install-deps.sh b/scripts/install-deps.sh index 77248fdcb..221e9790c 100755 --- a/scripts/install-deps.sh +++ b/scripts/install-deps.sh @@ -5,7 +5,14 @@ if command -v sudo &> /dev/null; then fi if command -v apt &> /dev/null; then + if ! (command -v clang &> /dev/null || command -v gcc &> /dev/null); then + echo "Neither clang nor gcc found. Installing gcc..." + $SUDO apt update && $SUDO apt install -y gcc build-essential python3-dev + fi + $SUDO apt update && $SUDO apt install -y jq \ + build-essential \ + python3-dev \ libpixman-1-dev \ libcairo2-dev \ libpango1.0-dev \ From a96256c02b8677897b595220aa9637b68442410a Mon Sep 17 00:00:00 2001 From: tomcodgen <191515280+tomcodgen@users.noreply.github.com> Date: Wed, 12 Mar 2025 16:28:56 +0000 Subject: [PATCH 2/2] Automated pre-commit update --- hatch.toml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hatch.toml b/hatch.toml index 0421d50b3..a7bd23596 100644 --- a/hatch.toml +++ b/hatch.toml @@ -38,8 +38,12 @@ compile_args = [ ], arch = "arm64", arg = "-mcpu=apple-m1" }, ] env = [ - { env = "CC", arg = "cc", platforms = ["linux"] }, - { env = "CC", arg = "clang", platforms = ["darwin"] } + { env = "CC", arg = "cc", platforms = [ + "linux", + ] }, + { env = "CC", arg = "clang", platforms = [ + "darwin", + ] }, ] cythonize_kwargs = { annotate = true, nthreads = 16, exclude_failures = false, cache = true } compiled_sdist = true