Merge branch 'python3.12-remove-distutils' into 'main'

Switch from the Python distutils module to the packaging module

Closes #3134

See merge request GNOME/glib!3740
This commit is contained in:
Philip Withnall 2023-12-05 15:50:15 +00:00
commit c40fa821b8
8 changed files with 12 additions and 9 deletions

View File

@ -11,11 +11,11 @@ cache:
- _ccache/
variables:
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/glib/fedora:v23"
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/glib/fedora:v24"
COVERITY_IMAGE: "registry.gitlab.gnome.org/gnome/glib/coverity:v7"
DEBIAN_IMAGE: "registry.gitlab.gnome.org/gnome/glib/debian-stable:v17"
DEBIAN_IMAGE: "registry.gitlab.gnome.org/gnome/glib/debian-stable:v18"
ALPINE_IMAGE: "registry.gitlab.gnome.org/gnome/glib/alpine:v0"
MINGW_IMAGE: "registry.gitlab.gnome.org/gnome/glib/mingw:v13"
MINGW_IMAGE: "registry.gitlab.gnome.org/gnome/glib/mingw:v14"
MESON_TEST_TIMEOUT_MULTIPLIER: 4
G_MESSAGES_DEBUG: all
MESON_COMMON_OPTIONS: "--buildtype debug --wrap-mode=nodownload --fatal-meson-warnings"
@ -607,6 +607,7 @@ macos-x86_64:
- source .venv/bin/activate
- pip3 install meson==1.2.3
- pip3 install ninja==1.11.1
- pip3 install packaging==23.2
script:
# FIXME: Use --wrap-mode=default so we download dependencies each time,
# until the macOS runner is a VM where we can use a pre-made image which

View File

@ -35,6 +35,7 @@ RUN apt-get update -qq && apt-get install --no-install-recommends -qq -y \
locales \
ninja-build \
python3 \
python3-packaging \
python3-pip \
python3-setuptools \
python3-wheel \

View File

@ -47,6 +47,7 @@ RUN dnf -y update \
ninja-build \
pcre2-devel \
"python3-dbusmock >= 0.18.3-2" \
python3-packaging \
python3-pip \
python3-pygments \
python3-wheel \

View File

@ -1,4 +1,4 @@
FROM registry.gitlab.gnome.org/gnome/glib/fedora:v23
FROM registry.gitlab.gnome.org/gnome/glib/fedora:v24
USER root

View File

@ -12,7 +12,7 @@ for %%x in (%*) do (
set args=%args:~1%
:: FIXME: make warnings fatal
pip3 install --upgrade --user meson==1.2.3 || goto :error
pip3 install --upgrade --user meson==1.2.3 packaging==23.2 || goto :error
meson setup %args% _build || goto :error
python .gitlab-ci/check-missing-install-tag.py _build || goto :error
meson compile -C _build || goto :error

View File

@ -26,7 +26,7 @@ CCACHE_BASEDIR="$(pwd)"
CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
export CCACHE_BASEDIR CCACHE_DIR
pip3 install --upgrade --user meson==1.2.3
pip3 install --upgrade --user meson==1.2.3 packaging==23.2
PATH="$(cygpath "$USERPROFILE")/.local/bin:$HOME/.local/bin:$PATH"
DIR="$(pwd)"

View File

@ -19,7 +19,7 @@
#
# Author: David Zeuthen <davidz@redhat.com>
import distutils.version
import packaging.version
import os
import sys
@ -166,4 +166,4 @@ def version_cmp_key(key):
v = str(key[0])
else:
v = "0"
return (distutils.version.LooseVersion(v), key[1])
return (packaging.version.Version(v), key[1])

View File

@ -2381,7 +2381,7 @@ python = import('python').find_installation()
python_name = 'python3'
python_version = python.language_version()
python_version_req = '>=3.5'
python_version_req = '>=3.7'
if not python_version.version_compare(python_version_req)
error('Requires Python @0@, @1@ found.'.format(python_version_req, python_version))
endif