diff options
author | Yonggang Luo <luoyonggang@gmail.com> | 2023-12-18 18:16:47 +0800 |
---|---|---|
committer | Eric Engestrom <eric@engestrom.ch> | 2024-01-02 16:20:17 +0000 |
commit | 92cdf6cb5f25f632350d8ca0d9451b0e87194ca3 (patch) | |
tree | b1c6f326067200fd779a55d1c6820adcd8454f4f | |
parent | 0b44ec8648a8962ef7f084f5c61a5c7ce7f0aeb0 (diff) | |
download | mesa-92cdf6cb5f25f632350d8ca0d9451b0e87194ca3.tar.gz mesa-92cdf6cb5f25f632350d8ca0d9451b0e87194ca3.tar.bz2 mesa-92cdf6cb5f25f632350d8ca0d9451b0e87194ca3.zip |
meson: Support for both packaging and distutils
distutils was deprecated and is now gone on modern systems.
so the default behavior is to use the supported thing, which is packaging.version, and when on an old system, fallback to the old distutils.version.
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9943
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26746>
(cherry picked from commit 670a799ebff9a98daafccf49324c2a01311b0c41)
-rw-r--r-- | .pick_status.json | 2 | ||||
-rw-r--r-- | meson.build | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/.pick_status.json b/.pick_status.json index 423bf9ae406..3017416f462 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -2464,7 +2464,7 @@ "description": "meson: Support for both packaging and distutils", "nominated": false, "nomination_type": 3, - "resolution": 4, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/meson.build b/meson.build index 35cc5f1cd5f..2902c1019f6 100644 --- a/meson.build +++ b/meson.build @@ -886,9 +886,12 @@ prog_python = import('python').find_installation('python3') has_mako = run_command( prog_python, '-c', ''' -from distutils.version import StrictVersion +try: + from packaging.version import Version +except: + from distutils.version import StrictVersion as Version import mako -assert StrictVersion(mako.__version__) >= StrictVersion("0.8.0") +assert Version(mako.__version__) >= Version("0.8.0") ''', check: false) if has_mako.returncode() != 0 error('Python (3.x) mako module >= 0.8.0 required to build mesa.') |