summaryrefslogtreecommitdiff
path: root/config/gr_python.m4
diff options
context:
space:
mode:
authorjblum <jblum@221aa14e-8319-0410-a670-987f0aec2ac5>2009-02-05 22:51:03 +0000
committerjblum <jblum@221aa14e-8319-0410-a670-987f0aec2ac5>2009-02-05 22:51:03 +0000
commitd0abb2bcf6832310a32ace3513dee181134778a6 (patch)
tree300bc7e308bdef9f6f784b5718bdb5fca5595f99 /config/gr_python.m4
parent9b388ac1184c71449c49fb44551c5c38f8098d8e (diff)
PYTHON_CHECK_MODULE: added extra argument for assertion tests (ex: version testing)
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10399 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'config/gr_python.m4')
-rw-r--r--config/gr_python.m432
1 files changed, 22 insertions, 10 deletions
diff --git a/config/gr_python.m4 b/config/gr_python.m4
index ea6df49c44..7479f0533d 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
])