contrib: better autotect python files to format for "nm-python-black-format.sh" script

This commit is contained in:
Thomas Haller 2022-04-05 09:35:53 +02:00
parent 4e28bd5a94
commit f3be419719
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -29,13 +29,6 @@ fi
OLD_IFS="$IFS"
IFS=$'\n'
FILES=( $(git ls-tree --name-only -r HEAD | grep '\.py$') )
IFS="$OLD_IFS"
FILES+=(
"examples/python/gi/nm-wg-set"
)
usage() {
printf "Usage: %s [OPTION]...\n" "$(basename "$0")"
printf "Reformat python source files using python black.\n\n"
@ -77,6 +70,13 @@ while (( $# )); do
esac
done
IFS=$'\n'
FILES=()
FILES+=( $(git ls-tree --name-only -r HEAD | grep '\.py$') )
FILES+=( $(git grep -l '#!.*\<p[y]thon3\?\>') )
FILES=( $(printf "%s\n" "${FILES[@]}" | sort -u) )
IFS="$OLD_IFS"
if [ $SHOW_FILENAMES = 1 ]; then
printf '%s\n' "${FILES[@]}"
exit 0