From 4bd338a1f83778a85f0152f1d5612af64d8479c4 Mon Sep 17 00:00:00 2001 From: John Dennis Date: Sat, 7 Jul 2018 11:43:18 -0400 Subject: [PATCH] - Modify configure to search for versioned python - Resolves: rhbz#1598047 --- lasso.spec | 8 +++++- versioned-python-configure.patch | 48 ++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 versioned-python-configure.patch diff --git a/lasso.spec b/lasso.spec index ae0f5d0..5f91e5b 100644 --- a/lasso.spec +++ b/lasso.spec @@ -58,7 +58,7 @@ Summary: Liberty Alliance Single Sign On Name: lasso Version: 2.6.0 -Release: 5%{?dist} +Release: 6%{?dist} License: GPLv2+ Group: System Environment/Libraries Source: http://dev.entrouvert.org/lasso/lasso-%{version}.tar.gz @@ -66,6 +66,7 @@ Source: http://dev.entrouvert.org/lasso/lasso-%{version}.tar.gz Patch1: use-specified-python-interpreter.patch Patch2: build-scripts-py3-compatible.patch Patch3: duplicate-python-LogoutTestCase.patch +Patch4: versioned-python-configure.patch BuildRequires: libtool autoconf automake @@ -188,6 +189,7 @@ library. %patch1 -p1 %patch2 -p1 %patch3 -p1 +%patch4 -p1 # Remove any python script shebang lines (unless they refer to python3) sed -i -E -e '/^#![[:blank:]]*(\/usr\/bin\/env[[:blank:]]+python[^3]?\>)|(\/usr\/bin\/python[^3]?\>)/d' \ @@ -312,6 +314,10 @@ rm -fr %{buildroot}%{_defaultdocdir}/%{name} %endif %changelog +* Sat Jul 7 2018 - 2.6.0-6 +- Modify configure to search for versioned python +- Resolves: rhbz#1598047 + * Wed Jul 04 2018 Petr Pisar - 2.6.0-5 - Perl 5.28 rebuild diff --git a/versioned-python-configure.patch b/versioned-python-configure.patch new file mode 100644 index 0000000..9fe3d57 --- /dev/null +++ b/versioned-python-configure.patch @@ -0,0 +1,48 @@ +commit af29047480cacafaed697cb2a1fb24c5143078a8 +Author: John Dennis +Date: Sat Jul 7 10:59:32 2018 -0400 + + Configure should search for versioned Python interpreter. + + Following the guidelines in Python PEP 394 with regards to the python + command on UNIX like systems preference should be given to explicitly + versioned command interpreter as opposed to unversioned and that an + unversioned python command should (but might not) refer to + Python2. Also in some environments unversioned Python interpreters + (e.g. /usr/bin/python) do not even exist, onlyh their explicitly + versioned variants are (e.g. /usr/bin/python2 and /usr/bin/python3). + + Therefore the AC_CHECK_PROGS directive in configure.ac should not rely + exclusively on an unversioned Python interpreter as it does not, + rather it should search in priority order. First for python3, then for + an unversionsed python because some distributions have already moved + the default unversioned python to python3, and then finally search for + python2. In the scenario where unversioned python is still pointing to + python2 it's equivalent to selecting the last prority option of + python2, but if unversioned python is pointing to python3 you get + instead. The net result is always preferring python3 but gracefully + falling back to python2 not matter how the environment exports it's + Python. + + If AC_CHECK_PROGS for python does not check for the versioned variants + the build fails in environments that only have versioned variants with + this error: + + configure: error: Python must be installed to compile lasso + + License: MIT + Signed-off-by: John Dennis + +diff --git a/configure.ac b/configure.ac +index 898468e6..74766972 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -131,7 +131,7 @@ dnl AC_CHECK_PROGS(JAR, fastjar jar) + AC_CHECK_PROGS(PERL, perl) + AC_CHECK_PROGS(PHP5, php5 php) + AC_CHECK_PROGS(PHP5_CONFIG, php-config5 php-config) +-AC_CHECK_PROGS(PYTHON, python) ++AC_CHECK_PROGS(PYTHON, python3 python python2) + AC_CHECK_PROGS(SWIG, swig) + + dnl Make sure we have an ANSI compiler