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
feat: support passenv #914
Conversation
Buggy Travis Windows. Anyway, how does this approach look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This approach seems good to me, yes.
In terms of names, how would you feel about environment_pass
/CIBW_ENVIRONMENT_PASS
? I'm just thinking to spiritually nest it within the environment option.
fc29064
to
7f379b1
Compare
I've implemented the Docker passthrough version, feel free to take a look. It can drive a new docker launch if you use an override to set it differently, but that should be rare. I like avoiding trying to escape these, and leaving it up to docker. It seemed to me passenv might be a bit of convention, possibly? I'm not sure if it is. Otherwise I don't have a strong option on it. I would be more inclined toward nesting if we'd made the nesting real (build.all instead of build-all, etc). |
Hmm. I'm not so sure this is better - a new Docker launch would be quite a surprise to anyone using this in an override, slowing down the build, and probably quite hard to figure out what was causing it. I think we can get the escaping right, I doubt that's a problem. I'm 99% sure that shlex.quote is the right thing, we already use it for this purpose elsewhere, e.g. cibuildwheel/cibuildwheel/docker_container.py Lines 156 to 161 in 08a6944
I had thought so too, but I can only find two references - the mod_env module of the Apache webserver, and tox. PassEnvironment actually seems more common. We haven't used 'env' anywhere yet in our options, so it would be better to be internally consistent, so CIBW_ENVIRONMENT_PASS or CIBW_PASS_ENVIRONMENT seem good. My preference would be slightly towards CIBW_ENVIRONMENT_PASS so it would sit next to CIBW_ENVIRONMENT neatly. |
environement_pass reads a little oddly, but is fine, then. I'll use that + the manual addition, but would like some help adding a good test for escaping. :) |
7f379b1
to
74cecd4
Compare
Only thing left would be one more test. |
Famous last words. Turns out shlex.quote -> bashlex doesn't work for everything. Actually I think the problem is in bashlex, but either way, I've implemented a different EnvironmentAssignment that passes straight through without bashlex for these passthrough variables. |
Good to go? |
Yep! |
This is an initial implementation of what passenv would look like. Some thought into escaping quotes is likely needed?