cibuildwheel icon indicating copy to clipboard operation
cibuildwheel copied to clipboard

Remove build specific environment variables from the test environment

Open mayeut opened this issue 1 year ago • 3 comments

Description

macOS builds are using multiple environment variables specific to the build environment: MACOSX_DEPLOYMENT_TARGET, _PYTHON_HOST_PLATFORM, ARCHFLAGS, SDKROOT

Those are propagated to the test environments. They should probably be removed from those.

see https://github.com/pypa/cibuildwheel/pull/1856#issuecomment-2156493426 and the 2 following comments for more context.

Build log

No response

CI config

No response

mayeut avatar Jun 09 '24 17:06 mayeut

While MACOSX_DEPLOYMENT_TARGET makes sense, the others might cause it to be harder to build wheels in the test step if wheels are missing from test dependencies. Not the best idea to build here, in general, but it may currently work because the correct variables are set for building.

henryiii avatar Jun 10 '24 06:06 henryiii

Maybe we should adapt them all then ?

If we're thinking that we might break some edge case that requires building from sources by removing any of those environment variable then IMHO we should update them all:

  • MACOSX_DEPLOYMENT_TARGET to the current running OS (this one is already done but was meant to be temporary, required by uv for now)
  • _PYTHON_HOST_PLATFORM/ARCHFLAGS to the current running test architecture as it's more likely to fail an universal2 build than a specific one. In fact, that was the issue when building matplotlib from sources in https://github.com/pypa/cibuildwheel/pull/1856#issuecomment-2156380899, it might have failed later on of course.

mayeut avatar Jun 10 '24 18:06 mayeut

I think removing these variables for the test step makes sense in general.

Probably the right approach would be to start again from os.environ rather than copying env here:

https://github.com/pypa/cibuildwheel/blob/7c3b0fbee8d7cb8d065a50d12b206978204a8238/cibuildwheel/macos.py#L675

And equivalents for the other platforms.

  • MACOSX_DEPLOYMENT_TARGET to the current running OS (this one is already done but was meant to be temporary, required by uv for now)

I don't follow this - normally on a user's machine MACOSX_DEPLOYMENT_TARGET isn't set and installing with uv works.

joerick avatar Oct 27 '24 14:10 joerick