Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion tools/yapf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,19 @@ 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)"
if command -v python3.10 &> /dev/null; then
PYTHON_EXEC="python3.10"
else
python3 -c "
import sys
version = sys.version_info
if (version.major, version.minor) > (3, 10):
print(f'Error: python3 version {version.major}.{version.minor} is greater than 3.10.', file=sys.stderr)
sys.exit(1)
else:
print(f'Using python3 version {version.major}.{version.minor}.')
" || exit 1
PYTHON_EXEC="python3"
fi

PYTHONPATH="$YAPF_DIR" python3 "$YAPF_DIR/yapf" "$@"
PYTHONPATH="$YAPF_DIR" $PYTHON_EXEC "$YAPF_DIR/yapf" "$@"