Skip to content

Commit 0fb4ce12f0637077ea9a1064f6447d3aa81c6ffa breaks py_binary bootstrap wrapper for Python 2 #2726

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

Closed
pw-mdb opened this issue Apr 1, 2025 · 3 comments

Comments

@pw-mdb
Copy link

pw-mdb commented Apr 1, 2025

🐞 bug report

Description

Commit 0fb4ce1 / PR #2481 breaks the py_binary bootstrap wrapper for systems that have Python 2 as the system Python. Reverting that commit fixes the issue.

Is this a regression?

Yes, regression as of commit 0fb4ce1. Commit was first released in version 1.1.0.

🔬 Minimal Reproduction

  1. Create a py_binary.
  2. Try to run it on a Linux system that has Python 2 as the system Python.

🔥 Exception or Error


  File ".runfiles/_main/build/tools/yamllint", line 92
    def print_verbose(*args, mapping=None, values=None):
                                   ^
SyntaxError: invalid syntax

🌍 Your Environment

Operating System:

  
amazonlinux2
  

Output of bazel version:

  
Bazelisk version: 1.25.0
Build label: 8.1.1
Build target: @@//src/main/java/com/google/devtools/build/lib/bazel:BazelServer
Build time: Tue Feb 25 18:53:44 2025 (1740509624)
Build timestamp: 1740509624
Build timestamp as int: 1740509624
  

Rules_python version:

  
1.0.0
  
@pw-mdb
Copy link
Author

pw-mdb commented Apr 1, 2025

Related: #2727

@rickeylev
Copy link
Collaborator

This is WAI. We no longer support python 2.

To work around this, you'll need to setup a custom toolchain and probably need to copy/paste the bootstrap and modify it to work with python 2. We have some docs to help walk through setting up a custom toolchain: https://rules-python.readthedocs.io/en/latest/toolchains.html#custom-toolchains

Setting --bootstrap_impl=script might work around this, assuming the program is using a python3 interpreter from its runfiles (or elsewhere). See https://rules-python.readthedocs.io/en/latest/api/rules_python/python/config_settings/index.html#bootstrap_impl

HTH!

@pw-mdb
Copy link
Author

pw-mdb commented Apr 2, 2025

@rickeylev Thank you for the pointers! I will follow up about --bootstrap_impl=script on the other issue. To be clear, the issue here is that commit 0fb4ce1 breaks the py_binary bootstrap wrapper for a system Python 2, even if the py_binary is Python 3. Are you saying system Python 2 is no longer supported at all?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants