Files
DeryFerd 734e1038a6 fix(windows-rocm): read the interpreter pin from the recipe
scripts/windows-rocm-recipe.json is the reviewed record of the interpreter the
Windows ROCm wheels and HIP runtime were tested against. scripts/setup-api.mjs
spelled the uv request out (cpython-3.12-windows-x86_64) and repeated 3.12 in its
x64 error, and the desktop readiness constant spells it out again, so a recipe
bump would leave both asking for an interpreter the recipe no longer pins.

Add a shared helper that turns the recipe into the uv request and the displayed
version, use it in the setup script, and add a test that runs the helper through
node against the shipped recipe and compares it with the desktop constant.

tests/test_windows_rocm_recipe_pin.py runs 3 passed; reverting the setup script
makes it fail with "the ROCm branch retypes the interpreter version instead of
reading the recipe".
2026-11-17 19:30:56 +07:00

31 lines
1.3 KiB
JavaScript

/**
* The interpreter the Windows ROCm recipe pins, in the form uv asks for it.
*
* `scripts/windows-rocm-recipe.json` is the source of truth: it carries the
* interpreter version, ABI and platform that the wheels and the HIP runtime were
* reviewed against. Both the setup script and the desktop readiness check have to
* agree with it, so neither of them spells the version out again.
*/
/** uv's target-triple name for the platform names the recipe uses. */
const UV_PLATFORM = { "win-amd64": "windows-x86_64", "win-arm64": "windows-aarch64" };
/** `cpython-<version>-<target>` for the recipe, or an error naming the missing field. */
export function windowsRocmPythonRequest(recipe) {
const python = recipe?.python ?? {};
const target = UV_PLATFORM[python.platform];
if (!python.version || !python.abi || !target) {
throw new Error(
"scripts/windows-rocm-recipe.json must pin python.version, python.abi and python.platform",
);
}
return `cpython-${python.version}-${target}`;
}
/** The human-readable interpreter version the recipe pins, for messages. */
export function windowsRocmPythonVersion(recipe) {
const version = recipe?.python?.version;
if (!version) throw new Error("scripts/windows-rocm-recipe.json must pin python.version");
return version;
}