[jhbuild] Drop Python 2 support.



commit 099dfa76386426b5e37fdf053b6cd408617c394a
Author: Christoph Reiter <reiter christoph gmail com>
Date:   Thu Nov 7 08:21:13 2019 +0100

    Drop Python 2 support.
    
    See #38

 .gitlab-ci.yml | 45 +++++----------------------------------------
 autogen.sh     |  6 ++++++
 configure.ac   | 29 ++---------------------------
 3 files changed, 13 insertions(+), 67 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 76261a50..88ac2772 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,30 +2,6 @@ stages:
   - test
   - deploy
 
-test-py2:
-  image: registry.gitlab.gnome.org/gnome/jhbuild/jhbuild:v3
-  script:
-    # autotools install
-    - mkdir _build && cd _build
-    - ../autogen.sh --with-python=python2
-    - make
-    - make install
-    - make distcheck
-    - cd ..
-    # simple install
-    - ./autogen.sh --simple-install --with-python=python2
-    - make install
-    - $HOME/.local/bin/jhbuild help
-    # flake 8
-    - python2 -m flake8 .
-    # docs
-    - mkdir public
-    - cd public
-    - yelp-build html ../doc/C/index.docbook
-  artifacts:
-    paths:
-      - public
-
 test-py3:
   image: registry.gitlab.gnome.org/gnome/jhbuild/jhbuild:v3
   script:
@@ -42,25 +18,14 @@ test-py3:
     - $HOME/.local/bin/jhbuild help
     # flake 8
     - python3 -m flake8 .
+    # docs
+    - mkdir public
+    - cd public
+    - yelp-build html ../doc/C/index.docbook
   artifacts:
     paths:
       - public
 
-ub19.04-py2-glib:
-  image: registry.gitlab.gnome.org/gnome/jhbuild/jhbuild:v3
-  script:
-    - ./autogen.sh  --with-python=python2
-    - make
-    - make install
-    - export PATH=$HOME/.local/bin:$PATH
-    - mkdir -p $HOME/.config
-    - echo "use_local_modulesets = True" >> $HOME/.config/jhbuildrc
-    - sudo apt-file update
-    - jhbuild help
-    - jhbuild --no-interact --exit-on-error sysdeps --install --assume-yes glib
-    - sudo apt install -y docbook-xml docbook-xsl
-    - jhbuild --no-interact --exit-on-error build glib
-
 ub19.04-py3-glib:
   image: registry.gitlab.gnome.org/gnome/jhbuild/jhbuild:v3
   script:
@@ -79,7 +44,7 @@ ub19.04-py3-glib:
 pages:
   image: alpine:latest
   stage: deploy
-  needs: ["test-py2"]
+  needs: ["test-py3"]
   script:
    - echo
   artifacts:
diff --git a/autogen.sh b/autogen.sh
index 238e8d25..bdd48c31 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -109,6 +109,12 @@ configure_without_autotools()
 {
   eval_gettext "Configuring \$PKG_NAME without autotools"; echo
 
+  python_major=$($python -c "import sys; sys.stdout.write(str(sys.version_info[0]))");
+  if [ "$python_major" != "3" ]; then
+    echo "Requires Python 3, Python $python_major found."
+    exit 1;
+  fi
+
   makefile="$srcdir/Makefile.plain"
   if [ "x$MSYSTEM" != "x" ]; then
     makefile="$srcdir/Makefile.windows"
diff --git a/configure.ac b/configure.ac
index e7ff8aa9..1c2fd95c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,7 +17,7 @@ AC_PROG_CC
 # Option to specify python interpreter to use; this just sets $PYTHON, so that
 # we will fall back to reading $PYTHON if --with-python is not given
 AC_ARG_WITH(python,
-  AS_HELP_STRING([--with-python=PATH],[Path to Python interpreter; searches $PATH if only a program name is 
given; if not given, searches for a few standard names such as "python3" or "python2"]),
+  AS_HELP_STRING([--with-python=PATH],[Path to Python interpreter; searches $PATH if only a program name is 
given; if not given, searches for a few standard names such as "python3"]),
   [PYTHON="$withval"], [])
 if test x"$PYTHON" = xyes; then
        AC_MSG_ERROR([--with-python option requires a path or program argument])
@@ -26,33 +26,8 @@ if test -n "$PYTHON" && ! command -v "$PYTHON" > /dev/null; then
        AC_MSG_ERROR([Python interpreter $PYTHON does not exist])
 fi
 
-# All this is supposed to do is check the Python version against python_min_ver
-# and python3_min_ver and prefer Python 3.x if nothing is set.
-m4_define(python_min_ver, 2.7)
 m4_define(python3_min_ver, 3.5)
-if test -n "$PYTHON"; then
-       AM_PATH_PYTHON([python_min_ver])
-       AM_PYTHON_CHECK_VERSION([$PYTHON], [3.0],
-                               build_py3k=true,
-                               build_py3k=false)
-       if test $build_py3k = true ; then
-               AC_MSG_CHECKING([for $PYTHON >=] python3_min_ver)
-               AM_PYTHON_CHECK_VERSION([$PYTHON], python3_min_ver,
-                                       [AC_MSG_RESULT(yes)],
-                                       [AC_MSG_ERROR(too old)])
-       fi
-else
-       AM_PATH_PYTHON([python3_min_ver], [], [
-               unset PYTHON;
-               # XXX: AM_PATH_PYTHON caching is broken and always returns the result of the first use
-               unset am_cv_pathless_PYTHON;
-               AM_PATH_PYTHON([python_min_ver], [
-                       AS_CASE(["$PYTHON_VERSION"],
-                               [2.*], [],
-                               [AC_MSG_ERROR([JHBuild requires Python ] python_min_ver [or] 
python3_min_ver)])
-               ])
-       ])
-fi
+AM_PATH_PYTHON([python3_min_ver])
 
 AC_SUBST([PYTHON_BASENAME], [$(basename "$PYTHON")])
 


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