Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access environment variables in config-settings #1710

Open
sarlinpe opened this issue Dec 24, 2023 · 0 comments
Open

Access environment variables in config-settings #1710

sarlinpe opened this issue Dec 24, 2023 · 0 comments

Comments

@sarlinpe
Copy link

sarlinpe commented Dec 24, 2023

Description

It would be handy to set config-settings based on some environment variables, for example when both the build and the before-all process need the same arguments, such as here using vcpkg:

[tool.cibuildwheel.macos]
before-all = "cd dependencies && cmake -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} && ..."

[tool.cibuildwheel.macos.environment]
VCPKG_INSTALLATION_ROOT = "/Users/runner/work/vcpkg"
CMAKE_TOOLCHAIN_FILE = "${VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake"
CMAKE_OSX_ARCHITECTURES = "${CIBW_ARCHS_MACOS}"

[tool.cibuildwheel.macos.config-settings]
"cmake.define.CMAKE_TOOLCHAIN_FILE" = "${CMAKE_TOOLCHAIN_FILE}"
"cmake.define.VCPKG_TARGET_TRIPLET" = "${VCPKG_TARGET_TRIPLET}"
"cmake.define.CMAKE_OSX_ARCHITECTURES" = "${CIBW_ARCHS_MACOS}"

Currently this doesn't work, though the doc does not make it clear. I think that this would require setting shell=True:

result = subprocess.run(args_, check=True, shell=IS_WIN, env=env, cwd=cwd, **kwargs)

But I'm unsure about potential side effects.

Build log

No response

CI config

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant