[ovs-dev,2/3] Partially revert "m4: Add hard requirements for python in "configure""

Message ID 52b9a5d71bf141f24e80b3f1f71888fa6820a7f6.1527705975.git.tredaelli@redhat.com
State New
Headers show
Series
  • Permit to build OVS with only Python3 installed
Related show

Commit Message

Timothy Redaelli May 31, 2018, 2:52 p.m.
This partially reverts commit 7777d53d2f4b84cc77868f2a55d66417fe6058d0.

Python2 check for "six.moves.range" is not reverted.

Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
---
 m4/openvswitch.m4 | 30 +++++++++++++-----------------
 1 file changed, 13 insertions(+), 17 deletions(-)

Comments

Ben Pfaff June 14, 2018, 8:50 p.m. | #1
On Thu, May 31, 2018 at 04:52:41PM +0200, Timothy Redaelli wrote:
> This partially reverts commit 7777d53d2f4b84cc77868f2a55d66417fe6058d0.
> 
> Python2 check for "six.moves.range" is not reverted.
> 
> Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>

Thanks for the patch.

The commit message doesn't make it clear to me the reason for the
patch.  Can you add a sentence or two?

Thanks,

Ben.

Patch

diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4
index 3f301b23b..f05b65c58 100644
--- a/m4/openvswitch.m4
+++ b/m4/openvswitch.m4
@@ -371,26 +371,22 @@  else:
             fi
           done
         done
+        if test $ovs_cv_python != no && test -x "$ovs_cv_python"; then
+          if ! "$ovs_cv_python" -c 'import six ; six.moves.range' >&AS_MESSAGE_LOG_FD 2>&1; then
+            ovs_cv_python=no
+            AC_MSG_WARN([Missing Python six library or version too old.])
+          fi
+        fi
       fi])
-
-   # Set $PYTHON from cache variable.
-   if test $ovs_cv_python = no; then
-     AC_MSG_ERROR([cannot find python 2.7 or higher.])
-   fi
-   AM_MISSING_PROG([PYTHON], [python])
-   PYTHON=$ovs_cv_python
-
-   # HAVE_PYTHON is always true.  (Python has not always been a build
-   # requirement, so this variable is now obsolete.)
    AC_SUBST([HAVE_PYTHON])
-   HAVE_PYTHON=yes
-   AM_CONDITIONAL([HAVE_PYTHON], [test "$HAVE_PYTHON" = yes])
-
-   AC_MSG_CHECKING([whether $PYTHON has six library])
-   if ! $PYTHON -c 'import six ; six.moves.range' >&AS_MESSAGE_LOG_FD 2>&1; then
-     AC_MSG_ERROR([Missing Python six library or version too old.])
+   AM_MISSING_PROG([PYTHON], [python])
+   if test $ovs_cv_python != no; then
+     PYTHON=$ovs_cv_python
+     HAVE_PYTHON=yes
+   else
+     HAVE_PYTHON=no
    fi
-   AC_MSG_RESULT([yes])])
+   AM_CONDITIONAL([HAVE_PYTHON], [test "$HAVE_PYTHON" = yes])])
 
 dnl Checks for Python 3.x, x >= 4.
 AC_DEFUN([OVS_CHECK_PYTHON3],