commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r9886 - gnuradio/branches/developers/jcorgan/deb-wip/c


From: jcorgan
Subject: [Commit-gnuradio] r9886 - gnuradio/branches/developers/jcorgan/deb-wip/config
Date: Wed, 29 Oct 2008 11:49:25 -0600 (MDT)

Author: jcorgan
Date: 2008-10-29 11:49:24 -0600 (Wed, 29 Oct 2008)
New Revision: 9886

Modified:
   gnuradio/branches/developers/jcorgan/deb-wip/config/gr_python.m4
   gnuradio/branches/developers/jcorgan/deb-wip/config/grc_gr_wxgui.m4
   gnuradio/branches/developers/jcorgan/deb-wip/config/grc_grc.m4
Log:
Improve Python module dependency checking

Modified: gnuradio/branches/developers/jcorgan/deb-wip/config/gr_python.m4
===================================================================
--- gnuradio/branches/developers/jcorgan/deb-wip/config/gr_python.m4    
2008-10-29 14:37:41 UTC (rev 9885)
+++ gnuradio/branches/developers/jcorgan/deb-wip/config/gr_python.m4    
2008-10-29 17:49:24 UTC (rev 9886)
@@ -126,3 +126,29 @@
            AC_SUBST(PYTHON_LDFLAGS)
        fi
 ])
+
+# PYTHON_CHECK_MODULE
+#
+# Determines if a particular Python module can be imported
+#
+# $1 - module name
+# $2 - module description
+# $3 - action if found
+# $4 - action if not found
+
+AC_DEFUN([PYTHON_CHECK_MODULE],[
+    AC_MSG_CHECKING([for $2]) 
+    python_cmd='import sys
+try:
+    import $1
+except:
+    sys.exit(1)'
+
+    if ! $PYTHON -c "$python_cmd" ; then
+       AC_MSG_RESULT([no])
+       $4
+    else
+       AC_MSG_RESULT([yes])
+       $3
+    fi
+])

Modified: gnuradio/branches/developers/jcorgan/deb-wip/config/grc_gr_wxgui.m4
===================================================================
--- gnuradio/branches/developers/jcorgan/deb-wip/config/grc_gr_wxgui.m4 
2008-10-29 14:37:41 UTC (rev 9885)
+++ gnuradio/branches/developers/jcorgan/deb-wip/config/grc_gr_wxgui.m4 
2008-10-29 17:49:24 UTC (rev 9886)
@@ -29,14 +29,8 @@
     dnl   yes  : if the --enable code passed muster and all dependencies are 
met
     dnl   no   : otherwise
     if test $passed = yes; then
-        if ! ${PYTHON} -c 'import wx'; then
-            AC_MSG_RESULT([gr-wxgui requires wxPython, not found.])
-            passed=no
-        fi
-        if ! ${PYTHON} -c 'import numpy'; then
-            AC_MSG_RESULT([gr-wxgui requires numpy (Numeric Python), not 
found.])
-            passed=no
-        fi
+       PYTHON_CHECK_MODULE([wx],[Python wxWidgets wrappers],[],[passed=no])
+       PYTHON_CHECK_MODULE([numpy],[Numeric Python extensions],[],[passed=no])
     fi
 
     AC_CONFIG_FILES([ \

Modified: gnuradio/branches/developers/jcorgan/deb-wip/config/grc_grc.m4
===================================================================
--- gnuradio/branches/developers/jcorgan/deb-wip/config/grc_grc.m4      
2008-10-29 14:37:41 UTC (rev 9885)
+++ gnuradio/branches/developers/jcorgan/deb-wip/config/grc_grc.m4      
2008-10-29 17:49:24 UTC (rev 9886)
@@ -29,18 +29,9 @@
     dnl # test python dependencies
     dnl ########################################
     if test $passed = yes; then
-        if ! ${PYTHON} -c 'import Cheetah'; then
-            AC_MSG_RESULT([grc requires the Python Cheetah templates 
installed, not found.])
-            passed=no
-        fi
-        if ! ${PYTHON} -c 'import pygtk'; then
-            AC_MSG_RESULT([grc requires Python GTK wrappers installed, not 
found.])
-            passed=no
-        fi
-        if ! ${PYTHON} -c 'import lxml'; then
-            AC_MSG_RESULT([grc requires libxml2 and libxslt wrappers (lxml), 
not found.])
-            passed=no
-        fi
+       PYTHON_CHECK_MODULE([Cheetah],[Python Cheetah templates],[],[passed=no])
+       PYTHON_CHECK_MODULE([pygtk],[Python GTK wrappers],[],[passed=no])
+       PYTHON_CHECK_MODULE([lxml],[Python XML wrappers],[],[passed=no])
     fi
 
     dnl ########################################





reply via email to

[Prev in Thread] Current Thread [Next in Thread]