-
Notifications
You must be signed in to change notification settings - Fork 423
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
Run Python in isolated mode unless in dev mode #4604
Conversation
|
The failure above was due to temporary connection issues, but I don't have permissions to issue a re-run there. Otherwise, ready for review! |
|
cc @conda/conda-core (there's no |
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.
@jaimergp hehe, you ran into the same issue we've been running into during recent releases, but unfortunately, we found workarounds at the time, so further work was postponed:
conda_build/build.py
Outdated
| '&& set CONDA_EXE={}' | ||
| '&& set CONDA_EXE={python_exe}' | ||
| '&& set CONDA_PYTHON_EXE={python_exe}' | ||
| '&& set _CE_I={}' |
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.
I want to change this to _CE_FLAGS? Is that possible, or will that result in too many other changes?
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 PR follows the code changes suggested at conda/conda#11995. I'd definitely appreciate less env vars exported, but we need to start with that PR... and I don't know if we can just get rid of env vars like that, given the possible backwards compatibility issues.
|
Are the CI tests run in debug mode? |
Co-authored-by: Ken Odegard <kodegard@anaconda.com>
|
Thanks! |
Description
conda buildgenerates some shell scripts wrappers to runbuild.shandbld.bat. This includes setting a number of environment variables and activating the host and build environments in a stacked way. To do this, it employspython -m conda shell.posix hook.However, the
-msemantics implies that the current working directories (SRC_DIRfor conda-build!) and other user installation paths are considered as part ofsys.path. This is usually ok, but there can be corner cases:condaand the version being packaged onSRC_DIRhappens to change howshell.posix hookworks, it might produce different code than what the released conda-build expects.hookgeneration steps, it might also break something?This discrepancy of which
condais used (the one onSRC_DIRvs the one installed next toconda-build) introduces a fragile behavior, but it can be easily fixed by just adding-I(isolated mode) to prevent leakage from non-installed locations:Why?
This bug has been discovered at conda/conda#11995. The sequence goes as:
conda-buildusespython -m condafor its shell integration. This means that it first findscondathe working directory (SRC_DIR) executes the hook as produced by the version being packaged.python -m condainstead ofPREFIX/bin/condain shell functions conda#11995, the hook will generate shell code with the form ofpython -I -m conda ...instead ofCONDA_PREFIX/bin/conda(the Python entry point) as the Python command to avoid shebang issues.-Iflag will force the nextconda activatecommands to run from thecondainstallation placed next toconda-build, not the one from the working directory!CONDA_PREFIX/bin/condaand unsets_CE_Mand_CE_CONDA(the shell variables that hold-mandcondastrings, respectively).python shell.posix activate, where it should have beenpython -I -m conda shell.posix activate. Of course,shell.posixis interpreted as a path to a file that doesn't exist and Python errors out.I know this is a corner case, but in my opinion, conda-build shouldn't rely on software being packaged as part of its implementation :)
Checklist - did you ...
newsdirectory (using the template) for the next release's release notes?Add / update necessary tests?Add / update outdated documentation?