[make] rewrite modified_py_files in python to be cross-platform (#8371)

* rewrite modified_py_files in python to be cross-platform

* try a different way to test for variable not being ""

* improve comment
This commit is contained in:
Stas Bekman
2020-11-07 09:45:16 -08:00
committed by GitHub
parent 07708793f2
commit 517eaf460b
2 changed files with 36 additions and 7 deletions

View File

@@ -3,14 +3,9 @@
check_dirs := examples tests src utils
# get modified files since the branch was made
fork_point_sha := $(shell git merge-base --fork-point master)
joined_dirs := $(shell echo $(check_dirs) | tr " " "|")
modified_py_files := $(shell git diff --name-only $(fork_point_sha) | egrep '^($(joined_dirs))' | egrep '\.py$$')
#$(info modified files are: $(modified_py_files))
modified_only_fixup:
@if [ -n "$(modified_py_files)" ]; then \
$(eval modified_py_files := $(shell python utils/get_modified_files.py $(check_dirs)))
@if test -n "$(modified_py_files)"; then \
echo "Checking/fixing $(modified_py_files)"; \
black $(modified_py_files); \
isort $(modified_py_files); \