-
Notifications
You must be signed in to change notification settings - Fork 248
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
Linux build can't access host environment variables #117
Comments
Of course, this is because on linux, the test environment is in the docker container. I think the right way to tackle this is during the |
I would agree in spirit. I have noticed this asymmetry before, and it seems to go into the purpose of However, on a technical/practical level, I don't think it's that easy, actually. Lots of these environment variables wouldn't make sense/would be wrong within the docker, no? I believe this is the main reason why the |
@YannickJadoul I think the most important thing is to be as consistent as possible across platforms. Your concerns are good ones though. I think an approach that could work would be to introduce an environment variable
Yes; I tried that: it doesn't work. |
OK, then I agree with the principle that we should find a (semi-)transparant way of transferring environment variables. Maybe we can introduce a way/notation in the Another thing I just thought of, would be something similar to the |
I still think re-using the |
I'm not familiar with either approaches, so coming to this cold. Initially I prefer the CIBW_HOST_* approach, since it is quite obvious where an env var comes from. However, I think the big downside is that there would have to be special cases to use these variables inside the container, which seems a bit leaky abstraction. So I'm wondering if we can do a PASSENV approach with a default that covers 90% of use cases, something like |
This would be really nice to have to make pyproject.toml easier (see #799 (comment)); how about just going with the explicit and simple option, [tool.cibuildwheel.linux]
passenv = ["MY_VAR", "GITHUB_REF"] It would be ignored on macOS/Windows, and would pass the listed variables in for Linux. |
This was implemented in #914. |
Does cibw pass windows environment variables automatically? In the docs I saw CIBW_ENVIRONMENT_PASS_LINUX (https://cibuildwheel.pypa.io/en/stable/options/#environment-pass) but I couldnt see one for windows. Could I do: [tool.cibuildwheel]
passenv = ["MY_VAR", "GITHUB_REF"] To pass environment variables for both windows and linux? |
For windows and macOS we build on the same machine as the command is triggered, so all environment variable are automatically passed. On Linux, we use a docker container, so we need to copy variables into the container. so the settings is relevant only to linux. |
The environment variables for commands run on linux and macos are inconsistent. On macos, the host environment variables are available to
CIBW_TEST_COMMAND
, whereas on linux they're not.For an example, see: https://travis-ci.org/python-lz4/python-lz4/builds/471284698 (compare py27 jobs).
On macos:
On linux:
The text was updated successfully, but these errors were encountered: