-
-
Notifications
You must be signed in to change notification settings - Fork 628
fix(system_python): write import paths to generated file instead of using PYTHONPATH #3242
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
fix(system_python): write import paths to generated file instead of using PYTHONPATH #3242
Conversation
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.
Gave a quick look at this and I think the change is really exciting. I'll do a thorough review once it is ready for review.
fyi @mering -- non-shell based bootstrap (still needs a system python, so not our coveted native launcher, but doesn't require you to have a shell installed) @jacky8hyf -- should make bootstrap=script work with site disabled ( |
…into refactor.two.stage.systempython
Ok, ready for review |
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 is really cool, thank you!
This changes the system_python bootstrap to use a 2-stage process like the script
bootstrap does. Among other things, this means the import paths are written to
a generated file (
bazel_site_init.py
, same as boostrap=script) and sys.pathsetup is performed by the Python code in stage 2.
Since the PYTHONPATH environment variable isn't used, this fixes the problem on
Windows where the value is too long.
This also better unifies the system_python and script based bootstraps because the
same stage 2 code and bazel_site_init code is used.
Along the way, several other improvements:
(stdlib, binary paths, runtime site packages).
-S
).interpreter_args
attribute andRULES_PYTHON_ADDITIONAL_INTERPRETER_ARGS
env var work with system_python.main_module
work with system_python.this because their environment doesn't install any shells as a security
precaution).
Fixes #2652