Repository navigation
Commit 415982c
authored
FIX: vendor the correct-arch mssql_py_core into Windows arm64 wheels (#737)
### Work Item / Issue Reference
>
[AB#47315](https://sqlclientdrivers.visualstudio.com/c6d89619-62de-46a0-8b46-70b92a84d85e/_workitems/edit/47315)
### Summary
Windows **arm64** wheels shipped a **wrong-architecture**
`mssql_py_core`, breaking bulk copy on arm64.
**Root cause.**
[`eng/scripts/install-mssql-py-core.ps1`](eng/scripts/install-mssql-py-core.ps1)
picked the core wheel from the **host** arch (`platform.machine()`).
Windows arm64 wheels are *cross-built on an x64 host*, so the installer
always fetched the `win_amd64` core and `setup.py bdist_wheel` packaged
it into the arm64 wheel. `validate_mssql_py_core()` only checks that a
`.pyd` *exists*, not its architecture, so nothing caught it — the arm64
wheel silently shipped an x64 bulk-copy binary.
**Fix (2 files):**
- **`install-mssql-py-core.ps1`** — new `-TargetArch` parameter. When
set, the core wheel is selected by the **target** arch; `aarch64` maps
to `arm64` in the Windows wheel-platform tag so it resolves `win_arm64`
(not `win_aarch64`); and the `import mssql_py_core` self-check is
skipped on cross-arch builds (an arm64 `.pyd` cannot load in the x64
build Python). Empty `-TargetArch` keeps host behaviour, so x64 and
local/native builds are unchanged.
- **`OneBranchPipelines/stages/build-windows-single-stage.yml`** — the
install step now passes `-TargetArch $(targetArch)`.
(`$env:ARCHITECTURE` isn't usable here — it's only `set` inline at
`bdist_wheel`, *after* the installer runs.)
**Why this is complete and safe:**
- The pinned core feed (`mssql-py-core-wheels` **0.1.9**, from
`eng/versions/mssql-py-core.version`) contains `win_arm64` wheels for
**cp311–cp314**, which exactly matches the Windows arm64 build matrix
(`3.11–3.14`; py3.10 arm64 is **not** built) — so every arm64 stage
resolves a matching core. No `setup.py` change is needed.
- x64 stages: `target == host` → verify still runs, no behaviour change.
**Validation.** PowerShell AST parse is clean; the arch-selection was
unit-checked on an x64 host — `arm64 → win_arm64` (cross-arch, verify
skipped), `x64`/empty `→ win_amd64` (verify runs) — all present in the
0.1.9 feed. Final proof is the arm64 Windows pipeline leg producing a
wheel whose vendored `mssql_py_core*.pyd` is ARM64.
**Follow-up (separate PR).** The conda `bld.bat` `mssql_py_core` strip
can be dropped once these arm64 wheels flow through (the "restore
path").1 parent 0085fd5 commit 415982c
2 files changed
Lines changed: 44 additions & 11 deletions
File tree
- OneBranchPipelines/stages
- eng/scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
302 | 306 | | |
303 | 307 | | |
304 | 308 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
13 | 22 | | |
14 | 23 | | |
15 | 24 | | |
16 | 25 | | |
17 | | - | |
| 26 | + | |
| 27 | + | |
18 | 28 | | |
19 | 29 | | |
20 | 30 | | |
| |||
34 | 44 | | |
35 | 45 | | |
36 | 46 | | |
37 | | - | |
| 47 | + | |
38 | 48 | | |
39 | 49 | | |
40 | 50 | | |
41 | 51 | | |
42 | 52 | | |
43 | 53 | | |
44 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
45 | 64 | | |
46 | | - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
47 | 72 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
| 73 | + | |
54 | 74 | | |
55 | 75 | | |
56 | | - | |
| 76 | + | |
| 77 | + | |
57 | 78 | | |
58 | 79 | | |
59 | 80 | | |
| |||
123 | 144 | | |
124 | 145 | | |
125 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
126 | 155 | | |
127 | 156 | | |
128 | 157 | | |
| |||
0 commit comments