Blame SOURCES/versioned-python-configure.patch

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