Blame SOURCES/versioned-python-configure.patch

0f20f5
commit af29047480cacafaed697cb2a1fb24c5143078a8
0f20f5
Author: John Dennis <jdennis@redhat.com>
0f20f5
Date:   Sat Jul 7 10:59:32 2018 -0400
0f20f5
0f20f5
    Configure should search for versioned Python interpreter.
0f20f5
    
0f20f5
    Following the guidelines in Python PEP 394 with regards to the python
0f20f5
    command on UNIX like systems preference should be given to explicitly
0f20f5
    versioned command interpreter as opposed to unversioned and that an
0f20f5
    unversioned python command should (but might not) refer to
0f20f5
    Python2. Also in some environments unversioned Python interpreters
0f20f5
    (e.g. /usr/bin/python) do not even exist, onlyh their explicitly
0f20f5
    versioned variants are (e.g. /usr/bin/python2 and /usr/bin/python3).
0f20f5
    
0f20f5
    Therefore the AC_CHECK_PROGS directive in configure.ac should not rely
0f20f5
    exclusively on an unversioned Python interpreter as it does not,
0f20f5
    rather it should search in priority order. First for python3, then for
0f20f5
    an unversionsed python because some distributions have already moved
0f20f5
    the default unversioned python to python3, and then finally search for
0f20f5
    python2. In the scenario where unversioned python is still pointing to
0f20f5
    python2 it's equivalent to selecting the last prority option of
0f20f5
    python2, but if unversioned python is pointing to python3 you get
0f20f5
    instead. The net result is always preferring python3 but gracefully
0f20f5
    falling back to python2 not matter how the environment exports it's
0f20f5
    Python.
0f20f5
    
0f20f5
    If AC_CHECK_PROGS for python does not check for the versioned variants
0f20f5
    the build fails in environments that only have versioned variants with
0f20f5
    this error:
0f20f5
    
0f20f5
    configure: error: Python must be installed to compile lasso
0f20f5
    
0f20f5
    License: MIT
0f20f5
    Signed-off-by: John Dennis <jdennis@redhat.com>
0f20f5
0f20f5
diff --git a/configure.ac b/configure.ac
0f20f5
index 898468e6..74766972 100644
0f20f5
--- a/configure.ac
0f20f5
+++ b/configure.ac
0f20f5
@@ -131,7 +131,7 @@ dnl AC_CHECK_PROGS(JAR, fastjar jar)
0f20f5
 AC_CHECK_PROGS(PERL, perl)
0f20f5
 AC_CHECK_PROGS(PHP5, php5 php)
0f20f5
 AC_CHECK_PROGS(PHP5_CONFIG, php-config5 php-config)
0f20f5
-AC_CHECK_PROGS(PYTHON, python)
0f20f5
+AC_CHECK_PROGS(PYTHON, python3 python python2)
0f20f5
 AC_CHECK_PROGS(SWIG, swig)
0f20f5
 
0f20f5
 dnl Make sure we have an ANSI compiler