[gobject-introspection/drop-python2-support: 2/2] Drop Python 2 support, require Python 3.4+



commit 77241a9e6f3e49da18f1ee05a8e97050918dec91
Author: Christoph Reiter <reiter christoph gmail com>
Date:   Sun Nov 4 13:23:17 2018 +0100

    Drop Python 2 support, require Python 3.4+
    
    glib did the same thing this cycle, see
    https://gitlab.gnome.org/GNOME/glib/merge_requests/196
    for details

 .gitlab-ci.yml           | 42 +-----------------------------------------
 .gitlab-ci/Dockerfile    |  4 ----
 .gitlab-ci/run-docker.sh |  2 +-
 configure.ac             |  7 ++-----
 meson.build              |  6 ++++++
 5 files changed, 10 insertions(+), 51 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 29ddc343..105903e1 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,7 +1,7 @@
 stages:
   - build
 
-image: registry.gitlab.gnome.org/gnome/gobject-introspection:v1
+image: registry.gitlab.gnome.org/gnome/gobject-introspection:v2
 
 cache:
   paths:
@@ -28,46 +28,6 @@ fedora-x86_64-meson-python3:
     paths:
       - "${CI_PROJECT_DIR}/_build/meson-logs"
 
-fedora-x86_64-meson-python2:
-  stage: build
-  variables:
-    CCACHE_BASEDIR: "${CI_PROJECT_DIR}"
-    CCACHE_DIR: "${CI_PROJECT_DIR}/_ccache"
-  script:
-    - meson --prefix /usr --libdir /usr/lib64 --buildtype debug -Dcairo=true -Dpython=python2 _build .
-    - cd _build
-    - ninja
-    - meson test --print-errorlogs --suite=gobject-introspection --no-suite=glib
-    - cd ..
-    - python2 -m pip install --user flake8
-    - python2 -m flake8 --count
-  except:
-    - tags
-  artifacts:
-    when: on_failure
-    name: "gi-_${CI_COMMIT_REF_NAME}"
-    paths:
-      - "${CI_PROJECT_DIR}/_build/meson-logs"
-
-fedora-x86_64-autotools-python2:
-  stage: build
-  variables:
-    CCACHE_BASEDIR: "${CI_PROJECT_DIR}"
-    CCACHE_DIR: "${CI_PROJECT_DIR}/_ccache"
-    CFLAGS: "-Werror"
-  script:
-    - sed -i 's|\[glib-2\.0 >= [0-9.]*\]|[glib-2.0 >= 1.0]|' configure.ac
-    - ./autogen.sh --with-python=python2 --enable-gtk-doc --enable-doctool
-    - make -j4
-    - make check
-    - python2 -m pip install --user flake8
-    - make check.quality
-  artifacts:
-    when: on_failure
-    name: "gi-_${CI_COMMIT_REF_NAME}"
-    paths:
-      - "${CI_PROJECT_DIR}/_build/meson-logs"
-
 fedora-x86_64-autotools-python3:
   stage: build
   variables:
diff --git a/.gitlab-ci/Dockerfile b/.gitlab-ci/Dockerfile
index bb770eac..0066675a 100644
--- a/.gitlab-ci/Dockerfile
+++ b/.gitlab-ci/Dockerfile
@@ -42,10 +42,6 @@ RUN dnf -y install \
     python3-markdown \
     python3-pip \
     python3-wheel \
-    python2 \
-    python2-devel \
-    python2-mako \
-    python2-markdown \
     redhat-rpm-config \
     systemtap-sdt-devel \
     zlib-devel \
diff --git a/.gitlab-ci/run-docker.sh b/.gitlab-ci/run-docker.sh
index 77eff633..31c49a2c 100755
--- a/.gitlab-ci/run-docker.sh
+++ b/.gitlab-ci/run-docker.sh
@@ -2,7 +2,7 @@
 
 set -e
 
-TAG="registry.gitlab.gnome.org/gnome/gobject-introspection:v1"
+TAG="registry.gitlab.gnome.org/gnome/gobject-introspection:v2"
 
 sudo docker build --build-arg HOST_USER_ID="$UID" --tag "${TAG}" \
     --file "Dockerfile" .
diff --git a/configure.ac b/configure.ac
index 2df0e2de..31206f36 100644
--- a/configure.ac
+++ b/configure.ac
@@ -258,16 +258,13 @@ AC_CHECK_FUNCS([backtrace backtrace_symbols])
 # we will fallback to reading $PYTHON if --with-python is not given, and
 # python.m4 will get the expected input
 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, 
such as "python3" or "python3.4", is given; if not given, searches for a few standard names]),
   [PYTHON="$withval"], [])
 if test x"$PYTHON" = xyes; then
     AC_MSG_ERROR([--with-python option requires a path or program argument])
 fi
-if test -n "$PYTHON" && ! which "$PYTHON"; then
-    AC_MSG_ERROR([Python interpreter $PYTHON does not exist])
-fi
+AM_PATH_PYTHON(3.4,,[AC_MSG_ERROR([Requires Python >=3.4])])
 
-AM_PATH_PYTHON([2.7])
 case "$host" in
 *-*-mingw*)
        # Change backslashes to forward slashes in pyexecdir to avoid
diff --git a/meson.build b/meson.build
index 4022e319..cf99b605 100644
--- a/meson.build
+++ b/meson.build
@@ -15,6 +15,12 @@ configinc = include_directories('.')
 pymod = import('python')
 python = pymod.find_installation(get_option('python'))
 
+python_version = python.language_version()
+python_version_req = '>=3.4'
+if not python_version.version_compare(python_version_req)
+  error('Requires Python @0@, @1@ found.'.format(python_version_req, python_version))
+endif
+
 cc = meson.get_compiler('c')
 config = configuration_data()
 config.set_quoted('GIR_SUFFIX', 'gir-1.0')


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