[Mesa-dev] [PATCH v3 13/24] configure: require python mako module
Jason Ekstrand
jason at jlekstrand.net
Thu Dec 11 11:28:04 PST 2014
On Tue, Dec 9, 2014 at 4:06 AM, Iago Toral Quiroga <itoral at igalia.com>
wrote:
> From: Samuel Iglesias Gonsalvez <siglesias at igalia.com>
>
> It is now a hard dependency because of the autogeneration of
> format pack and unpack functions.
>
> Update the documentation to reflect this change.
>
> v2:
> - Inline python script in m4 file and use PYTHON2
>
> Signed-off-by: Samuel Iglesias Gonsalvez <siglesias at igalia.com>
> ---
> configure.ac | 2 +
> docs/install.html | 6 ++-
> m4/ax_check_python_mako_module.m4 | 77
> +++++++++++++++++++++++++++++++++++++++
> 3 files changed, 84 insertions(+), 1 deletion(-)
> create mode 100644 m4/ax_check_python_mako_module.m4
>
> diff --git a/configure.ac b/configure.ac
> index 1d9d015..f38acfd 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -76,6 +76,8 @@ if test "x$INDENT" != "xcat"; then
> AC_SUBST(INDENT_FLAGS, '-i4 -nut -br -brs -npcs -ce -TGLubyte
> -TGLbyte -TBool')
> fi
>
> +AC_CHECK_PYTHON_MAKO_MODULE(0.7.3)
> +
> AC_PROG_INSTALL
>
> dnl We need a POSIX shell for parts of the build. Assume we have one
> diff --git a/docs/install.html b/docs/install.html
> index f12425f..b12e1cb 100644
> --- a/docs/install.html
> +++ b/docs/install.html
> @@ -38,6 +38,10 @@
> Version 2.6.4 or later should work.
> </li>
> <br>
> +<li><a href="http://www.makotemplates.org/">Python Mako module</a> -
> +Python Mako module is required. Version 0.7.3 or later should work.
> +</li>
> +</br>
> <li><a href="http://www.scons.org/">SCons</a> is required for building on
> Windows and optional for Linux (it's an alternative to autoconf/automake.)
> </li>
> @@ -78,7 +82,7 @@ the needed dependencies:
> <pre>
> sudo yum install flex bison imake libtool xorg-x11-proto-devel
> libdrm-devel \
> gcc-c++ xorg-x11-server-devel libXi-devel libXmu-devel libXdamage-devel
> git \
> - expat-devel llvm-devel
> + expat-devel llvm-devel python-mako
> </pre>
>
>
> diff --git a/m4/ax_check_python_mako_module.m4
> b/m4/ax_check_python_mako_module.m4
> new file mode 100644
> index 0000000..f289f26
> --- /dev/null
> +++ b/m4/ax_check_python_mako_module.m4
> @@ -0,0 +1,77 @@
> +#
> ===========================================================================
> +#
> +# SYNOPSIS
> +#
> +# AX_CHECK_PYTHON_MAKO_MODULE(MIN_VERSION_NUMBER)
> +#
> +# DESCRIPTION
> +#
> +# Check whether Python mako module is installed and its version higher
> than
> +# minimum requested.
> +#
> +# Example of its use:
> +#
> +# For example, the minimum mako version would be 0.7.3. Then
> configure.ac
> +# would contain:
> +#
> +# AC_CHECK_PYTHON_MAKO_MODULE(0.7.3)
> +#
> +# LICENSE
> +#
> +# Copyright (c) 2014 Intel Corporation.
> +#
> +# This program is free software; you can redistribute it and/or modify
> it
> +# under the terms of the GNU General Public License as published by the
> +# Free Software Foundation; either version 2 of the License, or (at your
> +# option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful, but
> +# WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> General
> +# Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> along
> +# with this program. If not, see <http://www.gnu.org/licenses/>.
> +#
> +# As a special exception, the respective Autoconf Macro's copyright
> owner
> +# gives unlimited permission to copy, distribute and modify the
> configure
> +# scripts that are the output of Autoconf when processing the Macro. You
> +# need not follow the terms of the GNU General Public License when using
> +# or distributing such scripts, even though portions of the text of the
> +# Macro appear in them. The GNU General Public License (GPL) does govern
> +# all other use of the material that constitutes the Autoconf Macro.
> +#
> +# This special exception to the GPL applies to versions of the Autoconf
> +# Macro released by the Autoconf Archive. When you make and distribute a
> +# modified version of the Autoconf Macro, you may extend this special
> +# exception to the GPL to apply to your modified version as well.
> +
> +dnl macro that checks for mako module in python
> +AC_DEFUN([AC_CHECK_PYTHON_MAKO_MODULE],
> +[AC_MSG_CHECKING(if module mako in python is installed)
> + echo "
> +try:
> + import sys
> + import mako
> +except ImportError as err:
> + sys.exit(err)
> +else:
> + ver_min_req_str = str('$1');
> + ver_min_req = ver_min_req_str.split('.');
>
Why are there semicolons?
> + ver_str = mako.__version__
> + ver = ver_str.split('.')
> +
> + for i in range(len(ver)):
> + ver_int = int(ver[[i]])
> + ver_min_req_int = int(ver_min_req[[i]]);
> + if ver_int < ver_min_req_int:
> + sys.exit(1);
> + if ver_int > ver_min_req_int:
> + sys.exit(0);
> + sys.exit(0);" | $PYTHON2 -
>
It would be nice to put the " and the |$PYTHON2 stuff on its own line so we
can see where the inline python ends.
> + if test $? -ne 0 ; then
> + AC_MSG_ERROR(mako $1 or later is required.)
> + else
> + AC_MSG_RESULT(yes)
> + fi
> +])
> --
> 1.9.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20141211/3e76d998/attachment.html>
More information about the mesa-dev
mailing list