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

Dylan Baker dylan at pnwbakers.com
Thu Aug 16 20:27:35 UTC 2018


Quoting Emil Velikov (2018-08-16 09:18:57)
> 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.

I believe python uses sym-version for releases, which is what StrictVersion is
for. I'm not sure how they tag pre-release versions (or if we really care about
pre-release versions). You should be fine with LooseVersion,

Reviewed-by: Dylan Baker <dylan at pnwbakers.com>

> ---
>  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
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180816/32350c7e/attachment.sig>


More information about the mesa-dev mailing list