Checks
Reproducible example
Minimal reproduction for a Windows pixi-build bug: [package.build.config.env]
values that reference $PREFIX are written literally into rattler-build's
build_env.bat instead of being expanded to absolute paths.
Reproduce
Expected failure today:
RuntimeError: CUDA_HOME was not expanded on Windows: '$PREFIX/Library'
Inspect the generated build environment:
type .pixi\bld\prefix-env-repro\*\work\build_env.bat | findstr /i "PREFIX CUDA_HOME"
Expected broken output:
@SET "PREFIX=C:\...\host"
@SET "LIBRARY_PREFIX=C:\...\host\Library"
@SET "CUDA_HOME=$PREFIX/Library"
pixi.toml:
[workspace]
channels = ["conda-forge"]
platforms = ["win-64"]
preview = ["pixi-build"]
[package]
name = "prefix-env-repro"
version = "0.1.0"
[package.build]
backend = { name = "pixi-build-python", version = "*" }
[package.host-dependencies]
python = "3.12.*"
setuptools = ">=80"
# Mirrors cuda-python's pattern for conda CUDA headers on Windows.
[package.build.target.win-64.config.env]
CUDA_HOME = "$PREFIX/Library"
pyproject.toml:
[build-system]
requires = ["setuptools>=80"]
build-backend = "build_hooks"
backend-path = ["."]
[project]
name = "prefix-env-repro"
version = "0.1.0"
build_hooks.py:
"""Minimal PEP 517 backend that asserts CUDA_HOME is expanded on Windows."""
import os
from setuptools import build_meta as _build_meta
prepare_metadata_for_build_wheel = _build_meta.prepare_metadata_for_build_wheel
get_requires_for_build_wheel = _build_meta.get_requires_for_build_wheel
def build_wheel(wheel_directory, config_settings=None, metadata_directory=None):
cuda_home = os.environ.get("CUDA_HOME") or os.environ.get("CUDA_PATH")
if not cuda_home:
raise RuntimeError("CUDA_HOME/CUDA_PATH not set in build env")
if "PREFIX" in cuda_home:
raise RuntimeError(
f"CUDA_HOME was not expanded on Windows: {cuda_home!r}. "
f"PREFIX={os.environ.get('PREFIX')!r} "
f"LIBRARY_PREFIX={os.environ.get('LIBRARY_PREFIX')!r}"
)
return _build_meta.build_wheel(wheel_directory, config_settings, metadata_directory)
Issue description
build.script.env placeholders like $PREFIX are not expanded when generating Windows build_env.bat
Expected behavior
build.script.env placeholders are expanded on Windows.
Checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pixi, using
pixi --version.Reproducible example
Minimal reproduction for a Windows pixi-build bug:
[package.build.config.env]values that reference
$PREFIXare written literally into rattler-build'sbuild_env.batinstead of being expanded to absolute paths.Reproduce
Expected failure today:
Inspect the generated build environment:
Expected broken output:
pixi.toml:
pyproject.toml:
build_hooks.py:
Issue description
build.script.env placeholders like
$PREFIXare not expanded when generating Windows build_env.batExpected behavior
build.script.env placeholders are expanded on Windows.