Skip to content

Commit

Permalink
configure: Check for presence of Python 3.
Browse files Browse the repository at this point in the history
The configure script already checked for Python 2 (>=2.7).  Add another
check for Python 3 (>=3.4).  This will be used later for automatically
running tests with Python 3 as well if available.

Signed-off-by: Russell Bryant <[email protected]>
Acked-by: Ben Pfaff <[email protected]>
  • Loading branch information
russellb committed Feb 22, 2016
1 parent 64eb96a commit 8fb7d02
Showing 3 changed files with 48 additions and 0 deletions.
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -95,6 +95,7 @@ OVS_CHECK_OPENSSL
OVS_CHECK_LIBCAPNG
OVS_CHECK_LOGDIR
OVS_CHECK_PYTHON
OVS_CHECK_PYTHON3
OVS_CHECK_FLAKE8
OVS_CHECK_DOT
OVS_CHECK_IF_PACKET
42 changes: 42 additions & 0 deletions m4/openvswitch.m4
Original file line number Diff line number Diff line change
@@ -358,6 +358,48 @@ else:
fi
AM_CONDITIONAL([HAVE_PYTHON], [test "$HAVE_PYTHON" = yes])])

dnl Checks for Python 3.x, x >= 4.
AC_DEFUN([OVS_CHECK_PYTHON3],
[AC_CACHE_CHECK(
[for Python 3.x for x >= 4],
[ovs_cv_python3],
[if test -n "$PYTHON3"; then
ovs_cv_python3=$PYTHON3
else
ovs_cv_python3=no
for binary in python3 python3.4; do
ovs_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for dir in $PATH; do
IFS=$ovs_save_IFS
test -z "$dir" && dir=.
if test -x "$dir"/"$binary" && "$dir"/"$binary" -c 'import sys
if sys.hexversion >= 0x03040000 and sys.hexversion < 0x04000000:
sys.exit(0)
else:
sys.exit(1)'; then
ovs_cv_python3=$dir/$binary
break 2
fi
done
done
if test $ovs_cv_python != no; then
if test -x "$ovs_cv_python" && ! "$ovs_cv_python" -c 'import six' >/dev/null 2>&1; then
ovs_cv_python=no
AC_MSG_WARN([Missing Python six library.])
fi
fi
fi])
AC_SUBST([HAVE_PYTHON3])
AM_MISSING_PROG([PYTHON3], [python3])
if test $ovs_cv_python3 != no; then
PYTHON3=$ovs_cv_python3
HAVE_PYTHON3=yes
else
HAVE_PYTHON3=no
fi
AM_CONDITIONAL([HAVE_PYTHON3], [test "$HAVE_PYTHON3" = yes])])


dnl Checks for dot.
AC_DEFUN([OVS_CHECK_FLAKE8],
[AC_CACHE_CHECK(
5 changes: 5 additions & 0 deletions tests/atlocal.in
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
# -*- shell-script -*-
HAVE_OPENSSL='@HAVE_OPENSSL@'
HAVE_PYTHON='@HAVE_PYTHON@'
HAVE_PYTHON3='@HAVE_PYTHON3@'
EGREP='@EGREP@'
PERL='@PERL@'

if test x"$PYTHON" = x; then
PYTHON='@PYTHON@'
fi

if test x"$PYTHON3" = x; then
PYTHON3='@PYTHON3@'
fi

PYTHONPATH=$abs_top_srcdir/python:$abs_top_builddir/tests:$PYTHONPATH
export PYTHONPATH

0 comments on commit 8fb7d02

Please sign in to comment.