[Piglit] [PATCH] gen_texure_lod_tests.py: Fix python 2.6 compatablility

Vinson Lee vlee at freedesktop.org
Sun May 25 22:05:54 PDT 2014


On Fri, May 23, 2014 at 12:53 AM, Dylan Baker <baker.dylan.c at gmail.com> wrote:
> In python 2.6 classes created by the collections.namedtuple factory do
> not have a __dict__ attribute. This means that calling
> **<object>.__dict__ to full a str.format() is impossible, and the
> arguments must be spilled out verbosely.
>
> bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79092
> Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
> ---
>  generated_tests/gen_texture_lod_tests.py | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/generated_tests/gen_texture_lod_tests.py b/generated_tests/gen_texture_lod_tests.py
> index f6bc086..6101341 100644
> --- a/generated_tests/gen_texture_lod_tests.py
> +++ b/generated_tests/gen_texture_lod_tests.py
> @@ -156,7 +156,9 @@ def main():
>      for params in LOD_TESTS:
>          name = ("spec/arb_shader_texture_lod/compiler/"
>                  "tex_lod-{mode}-{dimensions}-{coord}.frag".format(
> -                    **params.__dict__))
> +                    mode=params.mode,
> +                    dimensions=params.dimensions,
> +                    coord=params.coord))
>          print(name)
>          gen_frag_lod_test(params, name)
>
> @@ -164,14 +166,18 @@ def main():
>          # Generate fragment shader test
>          name = ("spec/arb_shader_texture_lod/compiler/"
>                  "tex_grad-{mode}-{dimensions}-{coord}.frag".format(
> -                    **params.__dict__))
> +                    mode=params.mode,
> +                    dimensions=params.dimensions,
> +                    coord=params.coord))
>          print(name)
>          gen_frag_grad_test(params, name)
>
>          # Generate vertex shader test
>          name = ("spec/arb_shader_texture_lod/compiler/"
>                  "tex_grad-{mode}-{dimensions}-{coord}.vert".format(
> -                    **params.__dict__))
> +                    mode=params.mode,
> +                    dimensions=params.dimensions,
> +                    coord=params.coord))
>          print(name)
>          gen_vert_grad_test(params, name)
>
> --
> 2.0.0.rc2
>

The build error also occurs with Python 2.7 but this patch fixes this.

Tested-by: Vinson Lee <vlee at freedesktop.org>


More information about the Piglit mailing list