[totem] plugins: Check for pylint at configure time if building with Python support



commit 290b3d6b482c7010da3881d56d762b0f353b5205
Author: Philip Withnall <philip tecnocode co uk>
Date:   Wed Dec 21 10:33:59 2011 +0000

    plugins: Check for pylint at configure time if building with Python support
    
    This means we don't error out during `make check` if pylint isn't found.

 configure.in                 |   12 +++++++-----
 src/plugins/Makefile.plugins |    4 +++-
 2 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/configure.in b/configure.in
index 7e34d6e..a479890 100644
--- a/configure.in
+++ b/configure.in
@@ -301,7 +301,8 @@ PKG_CHECK_MODULES(PEASGTK, libpeas-gtk-1.0 >= $PEAS_REQS)
 # ================================================================
 # Python plugins
 # ================================================================
-# We don't need any of this at compile time, but it is needed for the Python plugins at runtime, so we check anyway.
+# We don't Python or PyGObject at compile time, but they are needed for the Python plugins at runtime, so we check anyway.
+# We need pylint for `make check`.
 
 AC_MSG_CHECKING([whether Python plugin support is requested])
 AC_ARG_ENABLE([python],
@@ -313,7 +314,7 @@ AC_MSG_RESULT([$enable_python])
 have_python=no
 have_pygobject=no
 
-# Test for the Python run time and PyGObject
+# Test for the Python run time and PyGObject. Test for pylint as well, for `make check`.
 if test "x$enable_python" != "xno"; then
 	AM_PATH_PYTHON([$PYTHON_REQS],[have_python=yes],[have_python=no])
 	if test "x$PYTHON" = "x:"; then
@@ -321,15 +322,16 @@ if test "x$enable_python" != "xno"; then
 	fi
 
 	PKG_CHECK_MODULES([PYGOBJECT],[pygobject-3.0 >= $PYGOBJECT_REQS],[have_pygobject=yes],[have_pygobject=no])
+	AC_PATH_PROG([PYLINT], [pylint], [no])
 fi
 
 # Output the results of the Python checks
-if test "x$have_python" != "xyes" -o "x$have_pygobject" != "xyes"; then
+if test "x$have_python" != "xyes" -o "x$have_pygobject" != "xyes" -o "x$PYLINT" = "xno"; then
 	if test "x$enable_python" = "xyes"; then
-		AC_MSG_ERROR([python >= $PYTHON_REQS or pygobject-3.0 >= $PYGOBJECT_REQS not found])
+		AC_MSG_ERROR([python >= $PYTHON_REQS, pygobject-3.0 >= $PYGOBJECT_REQS or pylint not found])
 	elif test "x$enable_python" = "xautodetect"; then
 		enable_python=no
-		AC_MSG_WARN([python >= $PYTHON_REQS or pygobject-3.0 >= $PYGOBJECT_REQS not found; disabling Python support])
+		AC_MSG_WARN([python >= $PYTHON_REQS, pygobject-3.0 >= $PYGOBJECT_REQS or pylint not found; disabling Python support])
 	fi
 elif test "x$enable_python" != "xno"; then
 	enable_python=yes
diff --git a/src/plugins/Makefile.plugins b/src/plugins/Makefile.plugins
index ae0357c..c155e2e 100644
--- a/src/plugins/Makefile.plugins
+++ b/src/plugins/Makefile.plugins
@@ -32,9 +32,10 @@ plugin_libadd = \
 # Execute pylint on all the requisite files individually, returning non-zero
 # iff any of the calls to pylint returned non-zero.
 check-pylint: $(plugin_PYTHON)
+if ENABLE_PYTHON
 	@exitstatus=0; \
 	for py in $^; do \
-		pylint -i y -d C0111 -d W0511 $$py; \
+		$(PYLINT) -i y -d C0111 -d W0511 $$py; \
 		\
 		newexitstatus=$$?; \
 		if [ $$exitstatus == 0 ]; then \
@@ -42,6 +43,7 @@ check-pylint: $(plugin_PYTHON)
 		fi; \
 	done; \
 	exit $$exitstatus
+endif
 
 check: check-pylint
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]