Skip to content

Commit 18ecce0

Browse files
committed
build: keep _build_shared.py as identical copies
Replace the cuda_core symlink with a regular file and restore a pre-commit check that uses git diff --no-index so the two packages stay byte-identical without requiring Git symlink support to build.
1 parent 4c893de commit 18ecce0

3 files changed

Lines changed: 506 additions & 12 deletions

File tree

‎.pre-commit-config.yaml‎

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

84+
- id: check-build-shared-sync
85+
name: Check _build_shared.py copies are identical
86+
language: system
87+
pass_filenames: false
88+
files: '^(cuda_bindings|cuda_core)/_build_shared\.py$'
89+
entry: bash -c
90+
args:
91+
- 'git diff --no-index --exit-code -- cuda_bindings/_build_shared.py cuda_core/_build_shared.py || { echo "ERROR: cuda_bindings/_build_shared.py and cuda_core/_build_shared.py must be byte-identical. Copy one onto the other and commit both." >&2; exit 1; }'
92+
- "_" # fake script name, because bash considers $0 (the first argument) to be the script name
93+
8494
- id: no-markdown-in-docs-source
8595
name: Prevent markdown files in docs/source directories
8696
entry: bash -c

‎CONTRIBUTING.md‎

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ Thank you for your interest in contributing to CUDA Python! Based on the type of
4545
## Cloning the repository
4646

4747
> **Windows contributors (not WSL):** configure Git for symlinks *before*
48-
> cloning, or the shared PEP 517 build-hook file lands as a text stub instead
49-
> of a working symlink. See [Enabling git symlinks](#enabling-git-symlinks)
50-
> under Development on Windows.
48+
> cloning, or tracked symlinks (`CLAUDE.md`, `cuda_python/README.md`,
49+
> `.git_archival.txt`) land as text stubs. See
50+
> [Enabling git symlinks](#enabling-git-symlinks) under Development on Windows.
5151
5252
Every package in this repository derives its version from git tags using
5353
[`setuptools-scm`](https://setuptools-scm.readthedocs.io/), so **how you clone
@@ -143,12 +143,11 @@ of this document.
143143

144144
### Enabling git symlinks
145145

146-
The `cuda_core` PEP 517 backend shares source-of-truth helper files with
147-
`cuda_bindings` via symbolic links. Git materializes symlinks by default on
148-
Linux and macOS, but on Windows it needs to be configured before cloning,
149-
otherwise the "symlinks" land in your working tree as plain text files that
150-
contain the target path — enough to look right in `git status`, but not enough
151-
to actually build.
146+
Some files in this repository are Git symlinks, including `CLAUDE.md`,
147+
`cuda_python/README.md`, and the per-package `.git_archival.txt` files. Git
148+
materializes symlinks by default on Linux and macOS, but on Windows it needs
149+
to be configured before cloning, otherwise the "symlinks" land in your working
150+
tree as plain text files that contain the target path.
152151

153152
1. **[Activate Developer Mode](https://learn.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development#activate-developer-mode)**
154153
so Git can create symlinks without Administrator privileges.
@@ -170,8 +169,8 @@ setting alone won't take effect:
170169

171170
```console
172171
$ git config core.symlinks true # no --global — clears the repo-local override
173-
$ git rm --cached cuda_core/_build_shared.py
174-
$ git checkout HEAD -- cuda_core/_build_shared.py
172+
$ git rm --cached cuda_python/README.md
173+
$ git checkout HEAD -- cuda_python/README.md
175174
```
176175

177176
In practice, deleting the checkout and re-cloning after the two steps at

‎cuda_core/_build_shared.py‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)