mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
yapf: Add more detailed error message and TODO (flutter/engine#56458)
The yapf Python formatter is abandoned and only works with Python versions up to and including Python 3.11. upgraded, this will become more and more problematic. On some Linux distributions side-by-side python installations are unsupported, for example. Issue: https://github.com/flutter/flutter/issues/158384 [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This commit is contained in:
parent
cdc18f9d61
commit
cff2f440f9
@ -36,14 +36,22 @@ function follow_links() (
|
||||
SCRIPT_DIR=$(follow_links "$(dirname -- "${BASH_SOURCE[0]}")")
|
||||
SRC_DIR="$(cd "$SCRIPT_DIR/../.."; pwd -P)"
|
||||
YAPF_DIR="$(cd "$SRC_DIR/flutter/third_party/yapf"; pwd -P)"
|
||||
|
||||
# TODO: https://github.com/flutter/flutter/issues/158384
|
||||
# Migrate to a supported Python formatter.
|
||||
if command -v python3.10 &> /dev/null; then
|
||||
PYTHON_EXEC="python3.10"
|
||||
elif command -v python3.11 &> /dev/null; then
|
||||
PYTHON_EXEC="python3.11"
|
||||
else
|
||||
python3 -c "
|
||||
import sys
|
||||
version = sys.version_info
|
||||
if (version.major, version.minor) > (3, 11):
|
||||
print(f'Error: python3 version {version.major}.{version.minor} is greater than 3.11.', file=sys.stderr)
|
||||
print(f'Error: The yapf Python formatter requires Python version 3.11 or '
|
||||
f'earlier. The installed python3 version is '
|
||||
f'{version.major}.{version.minor}.',
|
||||
file=sys.stderr)
|
||||
sys.exit(1)
|
||||
else:
|
||||
print(f'Using python3 version {version.major}.{version.minor}.')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user