Skip to content

fix(build): pass base-prefix Python to cmake for SWIG bindings (#216)#219

Merged
BANANASJIM merged 3 commits into
BANANASJIM:masterfrom
K1ngst0m:fix/216-cmake-python-config
Apr 16, 2026
Merged

fix(build): pass base-prefix Python to cmake for SWIG bindings (#216)#219
BANANASJIM merged 3 commits into
BANANASJIM:masterfrom
K1ngst0m:fix/216-cmake-python-config

Conversation

@K1ngst0m
Copy link
Copy Markdown
Collaborator

@K1ngst0m K1ngst0m commented Apr 16, 2026

When running via pixi+uv, cmake's find_package(Python3) resolves the thin uv venv Python which lacks python3.XX-config. Pass -DPython3_EXECUTABLE pointing at the base-prefix interpreter (the pixi env) so cmake finds the config script it needs.

Closes #216

…ASJIM#216)

When running via pixi+uv, cmake's find_package(Python3) resolves the
thin uv venv Python which lacks python3.XX-config.  Pass
-DPython3_EXECUTABLE pointing at the base-prefix interpreter (the pixi
env) so cmake finds the config script it needs.

Closes BANANASJIM#216
@K1ngst0m K1ngst0m requested a review from BANANASJIM as a code owner April 16, 2026 08:08
Copy link
Copy Markdown

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 16, 2026

Warning

Rate limit exceeded

@BANANASJIM has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 47 minutes and 46 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 47 minutes and 46 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cc363c38-5fb1-4d75-8358-6c64a6a8fdb2

📥 Commits

Reviewing files that changed from the base of the PR and between ae66c7b and 08e315e.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (1)
  • src/rdc/_build_renderdoc.py
📝 Walkthrough

Walkthrough

The configure_build() function now attempts to set CMake's Python3_EXECUTABLE by detecting the Python interpreter at sys.base_prefix/bin/<python_executable_name> and conditionally appending this configuration to the CMake command if the path exists.

Changes

Cohort / File(s) Summary
CMake Python Configuration
src/rdc/_build_renderdoc.py
Added logic to detect and configure the base Python interpreter path for CMake's Python3_EXECUTABLE parameter, checking sys.base_prefix instead of the current environment's prefix.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Poem

🐰 A path through the base prefix I did find,
Where Python's true home awaits, carefully aligned,
CMake now knows where to look,
No virtualenv tricks in this book! 📚✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: passing the base-prefix Python interpreter to CMake for SWIG bindings, matching the core modification in src/rdc/_build_renderdoc.py.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/rdc/_build_renderdoc.py (1)

380-384: Add a regression test for the new Python3_EXECUTABLE injection path.

Line 380–384 introduces the core fix, but current configure_build() tests (for example in tests/unit/test_build_renderdoc.py around Line 299–328 and Line 310–316) don’t assert this new flag. Please add a focused test to lock this behavior and prevent regressions.

Proposed test addition
+def test_configure_sets_python3_executable_from_base_prefix(tmp_path: Path) -> None:
+    mock_run = MagicMock()
+    (tmp_path / "renderdoc").mkdir()
+    swig_dir = tmp_path / "renderdoc-swig"
+
+    base_prefix = tmp_path / "base"
+    base_python = base_prefix / "bin" / "python3.12"
+    base_python.parent.mkdir(parents=True)
+    base_python.write_text("")
+
+    with (
+        patch("subprocess.run", mock_run),
+        patch.object(br.sys, "base_prefix", str(base_prefix)),
+        patch.object(br.sys, "executable", "/tmp/venv/bin/python3.12"),
+    ):
+        br.configure_build(tmp_path, swig_dir, "linux")
+
+    args = mock_run.call_args[0][0]
+    assert f"-DPython3_EXECUTABLE={base_python}" in args
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/rdc/_build_renderdoc.py` around lines 380 - 384, The tests lack coverage
asserting that configure_build() injects -DPython3_EXECUTABLE when
sys.base_prefix's python executable exists; add a unit test in
tests/unit/test_build_renderdoc.py that mocks Path.exists() (or creates a
temporary fake base Python path) so that src/rdc/_build_renderdoc.py's
configure_build() (or the function that builds cmd) runs and the returned
command list contains f"-DPython3_EXECUTABLE={base_python}" (reference the
base_python variable and the Python3_EXECUTABLE flag) to lock this behavior and
prevent regressions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/rdc/_build_renderdoc.py`:
- Around line 380-384: The tests lack coverage asserting that configure_build()
injects -DPython3_EXECUTABLE when sys.base_prefix's python executable exists;
add a unit test in tests/unit/test_build_renderdoc.py that mocks Path.exists()
(or creates a temporary fake base Python path) so that
src/rdc/_build_renderdoc.py's configure_build() (or the function that builds
cmd) runs and the returned command list contains
f"-DPython3_EXECUTABLE={base_python}" (reference the base_python variable and
the Python3_EXECUTABLE flag) to lock this behavior and prevent regressions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f1ef01b5-08d5-4e89-bb8c-e049fb7459ce

📥 Commits

Reviewing files that changed from the base of the PR and between 97cb316 and ae66c7b.

📒 Files selected for processing (1)
  • src/rdc/_build_renderdoc.py

Resolves CVE-2026-40192 (pillow) and CVE-2025-71176 (pytest) that
cause the pip-audit CI step to fail on all open PRs.
Without this, the cmake Python workaround silently degrades to
the broken auto-detection it was meant to bypass.
Copy link
Copy Markdown

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@BANANASJIM BANANASJIM merged commit 796f362 into BANANASJIM:master Apr 16, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

setup-renderdoc fails on Linux with pixi + uv: cmake finds venv Python missing python3.XX-config

2 participants