-
Notifications
You must be signed in to change notification settings - Fork 239
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
Build-dependent environment variables #2110
Comments
Why cannot you import |
You are probably right, do you mean moving this logic into |
Hm. You are using custom wrapper around cmake? And resolve your problem by cmake extension like https://github.com/scikit-build/cython-cmake If you provide more detailed description, maybe @henryiii could suggest something. But for minimal required change, I'm suggest migrating logic to |
I will look into that, thanks.
What I want to do is build Python wrappings for an out of tree MLIR-based project. The issue here is that these are built by CMake and dumped into the CMake binary directory as a directory structure consisting of a bunch of Python files and Python extension modules. So my approach to making this work with |
So, based on my knowledge, using Optionally, you may read env variable in cmake. See: https://github.com/4DNucleome/PartSegCore-compiled-backend/blob/42c1b46104e02c5c5793245df35b868666da51ad/CMakeLists.txt#L19 |
After making some progress in on this it seems like cibuildwheel cannot handle this case anyways. It fails with "Build failed because a pure Python wheel was generated" (which is not true but I can sort of see why cibuildwheel thinks it is). I assume This is now deviating from my original question quite a bit but this is where I am at:
|
Description
I would like to set some build environment variables that depend
CIBW_BEFORE_BUILD
, that seems like it would be a very common requirement, e.g. in my case I want to:CIBW_BEFORE_BUILD
.CIBW_ENVIRONMENT'FOO_DIR=$(python "print(__import__(\"foo\").__path__[0])")'
Obviously this does not work since
CIBW_ENVIRONMENT
is evaluated beforeCIBW_BEFORE_BUILD
, the next logical thing to try would then beCIBW_BEFORE_BUILD='<fetch wheel> && export FOO_DIR="..."'
. But this also does not work since unlike withCIBW_ENVIRONMENT
,FOO_DIR
is then not available during the build step.CIBW_BEFORE_ALL
is also not very helpful since I would then have to "manually" iterate over all Python versions and their locations in/opt
for which to install thefoo
wheel.I'm not sure if this is necessarily a bug but it feels like an oversight unless there is a way to do this I have not considered.
Build log
No response
CI config
No response
The text was updated successfully, but these errors were encountered: