Skip to content

--bootstrap_impl=script breaks python_zip_file files #2596

Description

@philsc

🐞 bug report

Affected Rule

The issue is caused by the rule:

The py_binary's python_zip_file output doesn't work anymore when executed.

Is this a regression?

Without --bootstrap_impl=script, it seems to work fine.

Description

Setting the flag breaks running the zip files.

🔬 Minimal Reproduction

See https://github.com/philsc/rules_python-par-failure

py_binary(
name = "bin",
srcs = ["bin.py"],
)
filegroup(
name = "bin_zip_filegroup",
srcs = [":bin"],
output_group = "python_zip_file",
)
genrule(
name = "_bin.par",
srcs = [":bin_zip_filegroup"],
outs = ["bin.par"],
cmd = " && ".join([
"echo '#!/usr/bin/env python3' > $(OUTS)",
"cat $(SRCS) >> $(OUTS)",
]),
executable = True,
)

🔥 Exception or Error

$ bazel run //:bin.parINFO: Invocation ID: b3ca5fcf-e346-441b-92e3-e15b7ce33772INFO: Analyzed target //:bin.par (0 packages loaded, 0 targets configured).INFO: Found 1 target...Target //:bin.par up-to-date: bazel-bin/bin.parINFO: Elapsed time: 0.368s, Critical Path: 0.00sINFO: 1 process: 1 internal.INFO: Build completed successfully, 1 total actionINFO: Running command line: bazel-bin/bin.parTraceback (most recent call last): File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/data/phil_cache/bazel/_bazel_philipp.schrader/7bd7572ee132ae5e69d828af72559172/execroot/_main/bazel-out/k8-fastbuild/bin/bin.par/__main__.py", line 323, in <module> File "/data/phil_cache/bazel/_bazel_philipp.schrader/7bd7572ee132ae5e69d828af72559172/execroot/_main/bazel-out/k8-fastbuild/bin/bin.par/__main__.py", line 312, in main File "/data/phil_cache/bazel/_bazel_philipp.schrader/7bd7572ee132ae5e69d828af72559172/execroot/_main/bazel-out/k8-fastbuild/bin/bin.par/__main__.py", line 219, in execute_file File "/usr/lib/python3.10/subprocess.py", line 345, in call with Popen(*popenargs, **kwargs) as p: File "/usr/lib/python3.10/subprocess.py", line 971, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib/python3.10/subprocess.py", line 1863, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename)FileNotFoundError: [Errno 2] No such file or directory: '/tmp/Bazel.runfiles_2cv0a71b/runfiles/_main/_bin.venv/bin/python3'

🌍 Your Environment

Operating System:


$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.5 LTS
Release: 22.04
Codename: jammy

Output of bazel version:


$ bazel version
Bazelisk version: development
Build label: 8.0.1
Build target: @@//src/main/java/com/google/devtools/build/lib/bazel:BazelServer
Build time: Fri Jan 17 19:16:16 2025 (1737141376)
Build timestamp: 1737141376
Build timestamp as int: 1737141376

Rules_python version:


1.1.0

I also tried at 466da1d with the same result.

Anything else relevant?

I tried #2590 to see if it makes a difference, but it doesn't appear to.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions