diff options
Diffstat (limited to 'config')
-rw-r--r-- | config/gr_python.m4 | 32 | ||||
-rw-r--r-- | config/grc_grc.m4 | 35 |
2 files changed, 27 insertions, 40 deletions
diff --git a/config/gr_python.m4 b/config/gr_python.m4 index ea6df49c4..7479f0533 100644 --- a/config/gr_python.m4 +++ b/config/gr_python.m4 @@ -135,20 +135,32 @@ print path # $2 - module description # $3 - action if found # $4 - action if not found +# $5 - test command AC_DEFUN([PYTHON_CHECK_MODULE],[ - AC_MSG_CHECKING([for $2]) - python_cmd='import sys + AC_MSG_CHECKING([for $2]) + dnl ######################################## + dnl # import and test checking + dnl ######################################## + if test "$5"; then + python_cmd=' try: import $1 -except: - sys.exit(1)' - - if ! $PYTHON -c "$python_cmd" ; then - AC_MSG_RESULT([no]) - $4 + assert $5 +except: exit(1)' + dnl ######################################## + dnl # import checking only + dnl ######################################## + else + python_cmd=' +try: import $1 +except: exit(1)' + fi + if ! $PYTHON -c "$python_cmd" 2> /dev/null; then + AC_MSG_RESULT([no]) + $4 else - AC_MSG_RESULT([yes]) - $3 + AC_MSG_RESULT([yes]) + $3 fi ]) diff --git a/config/grc_grc.m4 b/config/grc_grc.m4 index d1e343988..2bb80a3d5 100644 --- a/config/grc_grc.m4 +++ b/config/grc_grc.m4 @@ -26,38 +26,13 @@ AC_DEFUN([GRC_GRC],[ AM_CONDITIONAL(XDG_UTILS, $XDG_UTILS) dnl ######################################## - dnl # test python version - dnl ######################################## - AC_MSG_CHECKING([for Python version >= 2.5]) - result=`${PYTHON} -c "import sys; print sys.version.split()[[0]] >= '2.5'"` - if test "$result" = "True"; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - passed=no - fi - - dnl ######################################## - dnl # test python dependencies - dnl ######################################## - if test $passed = yes; then - PYTHON_CHECK_MODULE([Cheetah],[Python Cheetah templates],[],[passed=no]) - PYTHON_CHECK_MODULE([lxml],[Python XML wrappers],[],[passed=no]) - PYTHON_CHECK_MODULE([pygtk],[Python GTK wrappers],[],[passed=no]) - fi - - dnl ######################################## - dnl # test gtk version + dnl # test python modules and versions dnl ######################################## if test $passed = yes; then - AC_MSG_CHECKING([for Python GTK version >= 2.10.0]) - result=`${PYTHON} -c "import gtk; print gtk.pygtk_version >= (2, 10, 0)" 2> /dev/null` - if test "$result" = "True"; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - passed=no - fi + PYTHON_CHECK_MODULE([sys],[Python >= 2.5],[],[passed=no],[sys.version.split()[[0]] >= "2.5"]) + PYTHON_CHECK_MODULE([Cheetah],[Python Cheetah templates >= 2.0.1],[],[passed=no],[Cheetah.Version >= "2.0.0"]) + PYTHON_CHECK_MODULE([lxml.etree],[Python lxml wrappers >= 2.0.0],[],[passed=no],[lxml.etree.LXML_VERSION >= (2, 0, 0, 0)]) + PYTHON_CHECK_MODULE([gtk],[Python gtk wrappers >= 2.10.0],[],[passed=no],[gtk.pygtk_version >= (2, 10, 0)]) fi dnl ######################################## |