[Mesa-dev] [PATCH 2/2] configure: use distutils in ax_check_python_mako_module

Emil Velikov emil.l.velikov at gmail.com
Thu Aug 16 16:18:57 UTC 2018


From: Emil Velikov <emil.velikov at collabora.com>

Handling the version comparison by hand is a bad idea. Python has a handy
module distutils for that - use it.

Cc: Dylan Baker <dylan at pnwbakers.com>
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
Not entirely sure if Loose or Strict version should be used. Input
highly appreciated.
---
 m4/ax_check_python_mako_module.m4 | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/m4/ax_check_python_mako_module.m4 b/m4/ax_check_python_mako_module.m4
index 7d9bb511c09..1d293d821c3 100644
--- a/m4/ax_check_python_mako_module.m4
+++ b/m4/ax_check_python_mako_module.m4
@@ -45,11 +45,12 @@ AC_DEFUN([AX_CHECK_PYTHON_MAKO_MODULE],
 try:
     import sys
     import mako
+    import distutils.version
 except ImportError as err:
     sys.exit(err)
 else:
-    ver_req = map(int, '$1'.split('.'))
-    ver_act = map(int, mako.__version__.split('.'))
+    ver_req = distutils.version.LooseVersion('$1')
+    ver_act = distutils.version.LooseVersion(mako.__version__)
     sys.exit(int(ver_req > ver_act))
     " | $PYTHON2 -
 
-- 
2.18.0



More information about the mesa-dev mailing list