[Kimchi-devel] [PATCH] [WoK 1/2] Makefile.am targets enhancements

dhbarboza82 at gmail.com dhbarboza82 at gmail.com
Mon Feb 1 12:46:10 UTC 2016


From: Daniel Henrique Barboza <dhbarboza82 at gmail.com>

- check-local: Added '.git' dir check in pyflakes to avoid an
error/warning when running check-local in a git submodule
tree. Added whitespace check too.

- ChangeLog and VERSION: these targets will now run properly
when running in a git submodule tree.

Signed-off-by: Daniel Henrique Barboza <dhbarboza82 at gmail.com>
---
 Makefile.am  | 26 ++++++++++++++++++--------
 configure.ac |  1 +
 2 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index a600661..dfaa38d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -48,15 +48,25 @@ I18N_FILES = src/wok/plugins/*/i18n.py \
 
 check-local:
 	PYTHONPATH=src contrib/check_i18n.py $(I18N_FILES)
-	find . -path './.git' -prune -type f -o \
-		-name '*.py' -o -name '*.py.in'  | xargs $(PYFLAKES) | \
-		grep -w -v $(SKIP_PYFLAKES_ERR) | \
-		while read LINE; do echo "$$LINE"; false; done
-
+	@if [ -d '.git' ]; then                                        \
+		find . -path './.git' -prune -o                        \
+			-name '*.py' -o -name '*.py.in'  |             \
+			xargs $(PYFLAKES) |                            \
+			while read LINE; do echo "$$LINE"; false; done \
+	else                                                           \
+		find . -name '*.py' -o -name '*.py.in'  |              \
+			xargs $(PYFLAKES) |                            \
+			while read LINE; do echo "$$LINE"; false; done \
+	fi
 	$(PEP8) --version
 	$(PEP8) --filename '*.py,*.py.in' --exclude="$(PEP8_BLACKLIST)" .
-
 	/bin/bash check_ui_code_errors.sh
+	@if $(GIT) rev-parse &> /dev/null ; then                             \
+		echo "Whitespace verification ...";                          \
+		git grep --cached -Il '' |                                   \
+			grep -v '^ui/css/src/vendor/' | xargs egrep '.* +$$' \
+			&& echo "ERROR: Whitespaces found" || echo "Ok";     \
+	fi
 
 # Link built mo files in the source tree to enable use of translations from
 # within the source tree
@@ -116,7 +126,7 @@ suse-rpm: contrib/wok.spec.suse
 	$(MAKE) rpm
 
 ChangeLog:
-	@if test -d .git; then                                   \
+	@if $(GIT) rev-parse &> /dev/null ; then                     \
 		$(top_srcdir)/build-aux/genChangelog --release > $@; \
 	fi
 
@@ -162,7 +172,7 @@ uninstall-local:
 	$(RM) $(DESTDIR)/etc/logrotate.d/wokd
 
 VERSION:
-	@if test -d .git; then                                \
+	@if $(GIT) rev-parse &> /dev/null ; then              \
 		git describe --abbrev=0 --always > $@;        \
 	fi
 
diff --git a/configure.ac b/configure.ac
index bfef1ba..9925753 100644
--- a/configure.ac
+++ b/configure.ac
@@ -37,6 +37,7 @@ AC_CONFIG_AUX_DIR([build-aux])
 AM_INIT_AUTOMAKE([-Wno-portability])
 AM_PATH_PYTHON([2.6])
 AC_PATH_PROG([PEP8], [pep8], [/usr/bin/pep8])
+AC_PATH_PROG([GIT], [git], [/usr/bin/git])
 AC_PYTHON_MODULE([unittest])
 AC_SUBST([HAVE_PYMOD_UNITTEST])
 AC_SUBST([PYTHON_VERSION])
-- 
2.5.0




More information about the Kimchi-devel mailing list