[Mesa-dev] [PATCH mesa 4/6] scons: use python3-compatible maps

Ilia Mirkin imirkin at alum.mit.edu
Tue Sep 19 14:52:11 UTC 2017


On Tue, Sep 19, 2017 at 10:14 AM, Eric Engestrom
<eric.engestrom at imgtec.com> wrote:
> Signed-off-by: Eric Engestrom <eric.engestrom at imgtec.com>
> ---
>  src/gallium/drivers/swr/SConscript | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/src/gallium/drivers/swr/SConscript b/src/gallium/drivers/swr/SConscript
> index fdced66463c912048e04..3b624ceccad4fc8bade2 100644
> --- a/src/gallium/drivers/swr/SConscript
> +++ b/src/gallium/drivers/swr/SConscript
> @@ -136,8 +136,7 @@ Depends('rasterizer/jitter/gen_state_llvm.h',
>  # 2 canEarlyZ
>  backendPixelRateFileCount = 4
>  backendPixelRateFilePat = "rasterizer/core/backends/gen_BackendPixelRate%s.cpp"
> -backendPixelRateFiles = map(lambda x: backendPixelRateFilePat % x,
> -                            range(0, backendPixelRateFileCount))
> +backendPixelRateFiles = [backendPixelRateFilePat % x for x in range(0, backendPixelRateFileCount)]

I very much prefer doing this as a generator rather than a list
comprehension [unless the aim is to support python2.3 -- seems
doubtful]. List comprehensions leave their variables in the scope, in
python2 (this was changed in python3, which of course makes existing
python2 code unportable to python3). In case that makes no sense to
you, I want:

backendPixelRateFiles = list(backendPixelRateFilePat % x for x in
range(0, backendPixelRateFileCount))

both here and below.

>  env.CodeGenerate(
>      target = 'rasterizer/core/backends/gen_BackendPixelRate.hpp',
>      script = swrroot + 'rasterizer/codegen/gen_backends.py',
> @@ -158,8 +157,7 @@ Depends(backendPixelRateFiles,
>  # 2 RasterScissorEdges
>  genRasterizerFileCount = 4
>  genRasterizerFilePat = "rasterizer/core/backends/gen_rasterizer%s.cpp"
> -genRasterizerFiles = map(lambda x: genRasterizerFilePat % x,
> -                         range(0, genRasterizerFileCount))
> +genRasterizerFiles = [genRasterizerFilePat % x for x in range(0, genRasterizerFileCount)]
>  env.CodeGenerate(
>      target = 'rasterizer/core/backends/gen_rasterizer.hpp',
>      script = swrroot + 'rasterizer/codegen/gen_backends.py',
> --
> Cheers,
>   Eric
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list