Module: Mesa
Branch: main
Commit: 670a799ebff9a98daafccf49324c2a01311b0c41
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=670a799ebff9a98daafccf49324c2a01311b0c41

Author: Yonggang Luo <[email protected]>
Date:   Mon Dec 18 18:16:47 2023 +0800

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 <[email protected]>
Reviewed-by: Eric Engestrom <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26746>

---

 meson.build | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index e3560589f83..8d103003f77 100644
--- a/meson.build
+++ b/meson.build
@@ -910,9 +910,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.')

Reply via email to