Closed linzhp closed 2 months ago
One approach might be to change the line
zip_dir=$(mktemp -d --suffix Bazel.runfiles_)
to
zip_dir=$(mktemp -d --suffix Bazel.runfiles_ 2>/dev/null || mktemp -d)
That would preserve existing behavior where --suffix Bazel.runfiles_
is available, and just drop it when it's not available.
Or we can use prefix instead
I was poking this a bit yesterday. I can't find anything that indicates why the Bazel.runfiles_
substring is meaningful. There's some code in the stage2 bootstrap, that looks for a similar pattern, but the "Bazel." prefix and the "_" suffix would cause that logic to not match. So yeah, best guess, it was just added as a human-friendly informative marker.
I'll just change the code to simply mktemp -d
.
🐞 bug report
Affected Rule
The issue is caused by the rule: python/private/stage1_bootstrap_template.sh
Is this a regression?
Yes, the Python zip built with bootstrap_impl=system_python works on macOS
Description
The stage 1 bootstrapper for Python zip file cannot run on macOS
🔬 Minimal Reproduction
bazel build --build_python_zip --@rules_python//python/config_settings:bootstrap_impl=script
🔥 Exception or Error
🌍 Your Environment
Operating System:
macOS Sonoma 14.5
Output of
bazel version
:7.2.0
Rules_python version:
0.33.2
Anything else relevant? This line is triggered when running a Python zip file. However, the mktemp command on macOS doesn't have the option
--suffix
.