diff --git a/engine/src/flutter/tools/yapf.sh b/engine/src/flutter/tools/yapf.sh index 382cc0c2118..ce651152971 100755 --- a/engine/src/flutter/tools/yapf.sh +++ b/engine/src/flutter/tools/yapf.sh @@ -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}.')