[jhbuild/wip/lantw/exit-early-if-python-is-not-python2] configure.ac: Exit early if PYTHON is not Python 2



commit e07248a0029705b99a3a61c027db8b5a49bb51b3
Author: Ting-Wei Lan <lantw src gnome org>
Date:   Tue Jun 25 00:54:37 2019 +0800

    configure.ac: Exit early if PYTHON is not Python 2
    
    JHBuild still only supports Python 2. However, automake doesn't seem to
    provide a way to choose between python 2 and 3, and it just accepts the
    default one if its version number is high enough. Therefore, on systems
    using Python 3 by default, JHBuild will be configured to use Python 3,
    causing JHBuild to crash immediately because of invalid syntax. In order
    to avoid installing a broken version of JHBuild, we should check the
    version ourselves and exit early if PYTHON is not Python 2.

 configure.ac | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/configure.ac b/configure.ac
index 78a76cf5..98a4f35b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -13,7 +13,10 @@ AM_MAINTAINER_MODE([enable])
 
 # Check for programs
 AC_PROG_CC
-AM_PATH_PYTHON
+AM_PATH_PYTHON([], [
+       AS_CASE(["$PYTHON_VERSION"],
+               [2.*], [],
+               [AC_MSG_ERROR([JHBuild only works with python 2])])])
 PKG_PROG_PKG_CONFIG
 
 # i18n


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]