Skip to content

Reverse order of checks for Python versions to run YAPF #170187

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

harryterkelsen
Copy link
Contributor

The yapf.sh script checks for specific "known-to-work-with-YAPF" versions of Python to run YAPF with. On my machine, I have python3.11 and python3.12 (python3 is a symlink to python3.12). However, the python3.11 release doesn't have lib2to3 so the YAPF script fails with:

Checking Python formatting...
To fix, run `et format` or:                                                                                   

git apply <<DONE
  /usr/local/google/home/het/Projects/flutter/engine/src/flutter/tools/gn
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/usr/local/google/home/het/Projects/flutter/engine/src/flutter/third_party/yapf/yapf/__main__.py", line 16, in <module>
    import yapf
  File "/usr/local/google/home/het/Projects/flutter/engine/src/flutter/third_party/yapf/yapf/__init__.py", line 35, in <module>
    from yapf.yapflib import errors
  File "/usr/local/google/home/het/Projects/flutter/engine/src/flutter/third_party/yapf/yapf/yapflib/errors.py", line 16, in <module>
    from lib2to3.pgen2 import tokenize
ModuleNotFoundError: No module named 'lib2to3'

DONE

On my Ubuntu machine I cannot install lib2to3 through normal APT packages; apt install python3.11-lib2to3 fails since that package has been obsoleted. I've been able to work around this by manually editing the yapf.sh script to not check for python3.10 or python3.11 first.

See #158384

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@harryterkelsen harryterkelsen requested a review from cbracken June 6, 2025 23:18
@github-actions github-actions bot added the engine flutter/engine repository. See also e: labels. label Jun 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
engine flutter/engine repository. See also e: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy