-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Enable custom py_binary stub_template attribute #6632
Conversation
Thanks for the PR! Please see my comments in #137. I'd consider this PR blocked pending a design doc. I'll see if I can write that doc tomorrow. |
What's the current state, @brandjon? |
ping everyone.
|
ping @brandjon |
Any updates on this PR? |
I'm running into some issues debugging an os error in the stub template and having a custom script would be useful. |
Hello @fahhem, The above PR has been stale from long time. Could you please check buildkite failures and address the above comments. Thanks |
I have this working on the bazel 4.0.0 tag internally. However, I don't want to spend time on this PR until I have a signal that someone from the bazel team will actually consider it. Last I checked, the issue was 'under design review' a couple years ago and no updates since. It's marked a P4 (though this PR is a P1??). If there's an actual chance of getting this in I'd be happy to update the branch and get it in |
@brandjon can you have a look/comment, please? |
@rickeylev is currently working on Python rules, he can probably take a look ;) |
I'm actively working on the CI failures, will post again when it's ready |
Unfortunately I can't seem to figure out why |
I somewhat echo Jon's thinking in #137 from back in Nov 2018. This is more appropriate as an attribute of py_runtime rather than py_binary. Most of what the stub template does is find the interpreter, runfiles, and setup the runtime environment for a binary. The majority of this doesn't vary on a per-binary bases. It does vary on a per-platform basis, though, which is better handled by the toolchain lookup process. A good example of this is windows vs mac vs linux differences; e.g. windows might use a batch file (or powershell or etc), while mac might use an old version of bash, and linux uses a newer version. There's other stuff, too, like coverage setup and execution. Handling those sort of differences on a per-binary basis is a hassle. I would accept adding an optional [1] not "stub_template"; the startup code is fairly complicated and does real things; "executable_template", "binary_template", etc are all more descriptive. If you want to experiment with something to allow a greater degree of customization, then we can try adding a callback somewhere on the py_runtime_pair or PyRuntimeInfo values to give the toolchain greater control over how the executable is created (basically allowing the toolchain to directly do what PythonSemantics.createExecutable is able to do). All that said, there's definitely still some binary-level customizations to propagate into the startup process. e.g., a binary might want to have certain interpreter flags set at startup that are difficult/impossible to customize post-interpreter startup (-b, -u, and other flags come to mind). So I'm +1 on exposing some attribute to pass along that information. |
@rickeylev Thank you for the comment! However, seeing as I can't make progress due to the |
Fixes bazelbuild#137, but unlike my approach in bazelbuild#6632, this adds an attribute to `py_runtime` rather than to `py_binary` Open to suggestions on the attribute name and documentation
Somehow I got it to work in #16806, so going to close this in favor of that PR getting in. |
Fixes bazelbuild#137, but unlike my approach in bazelbuild#6632, this adds an attribute to `py_runtime` rather than to `py_binary` Open to suggestions on the attribute name and documentation
Fixes bazelbuild#137, but unlike my approach in bazelbuild#6632, this adds an attribute to `py_runtime` rather than to `py_binary`
Fixes bazelbuild#137, but unlike my approach in bazelbuild#6632, this adds an attribute to `py_runtime` rather than to `py_binary` Open to suggestions on the attribute name and documentation
Fixes bazelbuild#137, but unlike my approach in bazelbuild#6632, this adds an attribute to `py_runtime` rather than to `py_binary` Open to suggestions on the attribute name and documentation
Fixes bazelbuild#137, but unlike my approach in bazelbuild#6632, this adds an attribute to `py_runtime` rather than to `py_binary` Open to suggestions on the attribute name and documentation
Fixes bazelbuild#137, but unlike my approach in bazelbuild#6632, this adds an attribute to `py_runtime` rather than to `py_binary` Open to suggestions on the attribute name and documentation
Fixes bazelbuild#137, but unlike my approach in bazelbuild#6632, this adds an attribute to `py_runtime` rather than to `py_binary` Open to suggestions on the attribute name and documentation Patched cc_shared_library to fix cc shared library transitive dependencies taking in upb protos Edit bootstrap template. Windows related updates. Use our stub template directly. Remove host version warning emission. Update builtins_bzl with better support for cc_shared_library's Transitive debug and run files. Repair transitive debug files. Some more fixes. Update python_bootstrap_template.txt Fix error prone ComparisonOutOfRange in PersistentStringIndexer PiperOrigin-RevId: 544294153 Change-Id: Ia89d02a025dfafa213d68ea2110a79e5adccf79c fix changed var name
Fixes #137
Wasn't too hard after all!
One note: the fact that the
TemplateExpansionAction
constructors switch the order of the template and the output depending on the type of the template (anArtifact
vs aTemplate
) took the longest amount of time in debugging for this PR.Lastly, I'm aware I didn't document the attribute very well. I'm open to suggestions!