diff --git a/test/python-black-check.sh b/test/python-black-check.sh index 93597db8..7a6fd0ab 100755 --- a/test/python-black-check.sh +++ b/test/python-black-check.sh @@ -7,4 +7,10 @@ fi cd "$MESON_SOURCE_ROOT" || exit 101 -black --check $(git ls-files "*.py" "*.py.in") +files=$(git ls-files "*.py" "*.py.in") +if [ -z "$files" ]; then + echo "Git didn't find any files" + exit 77 +fi + +black --check $files diff --git a/test/python-ruff-check.sh b/test/python-ruff-check.sh index f4c7ad16..0d726702 100755 --- a/test/python-ruff-check.sh +++ b/test/python-ruff-check.sh @@ -7,4 +7,10 @@ fi cd "$MESON_SOURCE_ROOT" || exit 101 -ruff check $(git ls-files "*.py" "*.py.in") +files=$(git ls-files "*.py" "*.py.in") +if [ -z "$files" ]; then + echo "Git didn't find any files" + exit 77 +fi + +ruff check $files diff --git a/tools/python-black.sh b/tools/python-black.sh index ada79792..e80a9d95 100755 --- a/tools/python-black.sh +++ b/tools/python-black.sh @@ -7,4 +7,10 @@ fi cd "$MESON_SOURCE_ROOT" || exit 101 -black $(git ls-files "*.py" "*.py.in") +files=$(git ls-files "*.py" "*.py.in") +if [ -z "$files" ]; then + echo "Git didn't find any files" + exit 77 +fi + +black $files diff --git a/tools/python-ruff.sh b/tools/python-ruff.sh index 98de940f..43885b4b 100755 --- a/tools/python-ruff.sh +++ b/tools/python-ruff.sh @@ -7,4 +7,10 @@ fi cd "$MESON_SOURCE_ROOT" || exit 101 -ruff check --fix $(git ls-files "*.py" "*.py.in") +files=$(git ls-files "*.py" "*.py.in") +if [ -z "$files" ]; then + echo "Git didn't find any files" + exit 77 +fi + +ruff check --fix $files