Skip to content

Commit ea58e1b

Browse files
authored
build: consolidate toolchain helpers (#3000)
build: consolidate toolchain helpers The toolchain, Cython cache, stamp, and CUDA-path helpers duplicated in cuda_bindings/build_hooks.py and cuda_core/build_hooks.py now live in cuda_bindings/_build_shared.py. cuda_core/_build_shared.py is a symlink to it. Each build_hooks.py keeps only what is per-package: C++ standard, bindings' -Wno-deprecated-declarations tweak, core's CUDA_PYTHON_WERROR, and the key each one stamps. A single source needs no drift check, so toolshed/check_build_hooks_sync.py and its hook go away. Shared tests move into mixins; Windows source-install notes and the remaining CI checkouts point at core.symlinks=true, which #2992 already required. No intended flag or env change: compiler/linker flags and CC/CXX/LDCXXSHARED are unchanged, except -Wno-deprecated-declarations is now last for bindings.
1 parent 669e608 commit ea58e1b

21 files changed

Lines changed: 1292 additions & 1538 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,9 @@ jobs:
631631
permissions:
632632
contents: read
633633
steps:
634+
- name: Enable Git symlinks (Windows, must precede checkout)
635+
run: git config --global core.symlinks true
636+
634637
- name: Checkout repository
635638
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
636639
with:

‎.github/workflows/coverage.yml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,9 @@ jobs:
232232
CUDA_PYTHON_COVERAGE: "1"
233233
CUDA_VER: ${{ needs.coverage-vars.outputs.CUDA_VER }}
234234
steps:
235+
- name: Enable Git symlinks (Windows, must precede checkout)
236+
run: git config --global core.symlinks true
237+
235238
- name: Checkout ${{ github.event.repository.name }}
236239
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
237240
with:
@@ -348,6 +351,9 @@ jobs:
348351
run:
349352
shell: bash --noprofile --norc -xeuo pipefail {0}
350353
steps:
354+
- name: Enable Git symlinks (Windows, must precede checkout)
355+
run: git config --global core.symlinks true
356+
351357
- name: Checkout ${{ github.event.repository.name }}
352358
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
353359
with:

‎.pre-commit-config.yaml‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,6 @@ repos:
8181
language: python
8282
files: '^cuda_core/tests/.*\.py$'
8383

84-
- id: check-build-hooks-sync
85-
name: Check shared build_hooks.py blocks are in sync
86-
entry: python ./toolshed/check_build_hooks_sync.py
87-
language: python
88-
files: '^(cuda_bindings|cuda_core)/build_hooks\.py$'
89-
pass_filenames: false
90-
9184
- id: no-markdown-in-docs-source
9285
name: Prevent markdown files in docs/source directories
9386
entry: bash -c

‎cuda_bindings/AGENTS.md‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ subpackage in the `cuda-python` monorepo.
1919
- **Platform internals**: `cuda/bindings/_internal/` contains
2020
platform-specific implementation files and support code.
2121
- **Build backend**: `build_hooks.py` drives extension configuration and
22-
Cythonization.
22+
Cythonization. Logic shared with `cuda_core` (toolchain selection, the
23+
compiler flag set, the Cython cache helpers and the rebuild stamps) lives
24+
in `_build_shared.py`; `cuda_core/_build_shared.py` is a symlink to this
25+
file, so an edit here changes both packages.
2326

2427
## Generated-source workflow
2528

‎cuda_bindings/MANIFEST.in‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ recursive-include cuda/ *.pyx *.pxd *.pxi *.pyx.in *.pxd.in *.pxi.in *.h
66
# to the payload, causing file copying to the build environment failed
77
exclude cuda/bindings cuda?bindings
88
exclude cuda/bindings/_bindings cuda?bindings?_bindings
9+
# canonical shared PEP 517 helper (cuda_core/_build_shared.py symlinks to the cuda_bindings copy)
10+
include _build_shared.py

0 commit comments

Comments
 (0)