[Mesa-dev] [PATCH v2] isl: Replace bash generator with python generator

Jason Ekstrand jason at jlekstrand.net
Fri Jun 10 20:25:37 UTC 2016


On Fri, Jun 10, 2016 at 1:16 PM, Emil Velikov <emil.l.velikov at gmail.com>
wrote:

> On 10 June 2016 at 01:31, Dylan Baker <dylan at pnwbakers.com> wrote:
> > This replaces the current bash generator with a python based generator
> > using mako. It's quite fast and works with both python 2.7 and python
> > 3.5, and should work with 3.3+ and maybe even 3.2.
> >
> > It produces an almost identical file except for a minor layout changes,
> > and the addition of a "generated file, do not edit" warning.
> >
> > Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
> >
> > v2: - Provide the python file with the csvfile and output location as
> >       arguments (Jason, Emil)
> >     - Put the mako template in the python file (Jason)
> >     - Merge Emil's Android.mk changes
> > ---
> >  src/intel/isl/Android.mk                 |   6 +-
> >  src/intel/isl/Makefile.am                |  13 +-
> >  src/intel/isl/gen_format_layout.py       | 207
> +++++++++++++++++++++++++++++++
> >  src/intel/isl/isl_format_layout_gen.bash | 129 -------------------
> >  4 files changed, 218 insertions(+), 137 deletions(-)
> >  create mode 100644 src/intel/isl/gen_format_layout.py
> >  delete mode 100755 src/intel/isl/isl_format_layout_gen.bash
> >
> > diff --git a/src/intel/isl/Android.mk b/src/intel/isl/Android.mk
> > index 3134981..ec3c656 100644
> > --- a/src/intel/isl/Android.mk
> > +++ b/src/intel/isl/Android.mk
> > @@ -139,14 +139,14 @@ LOCAL_GENERATED_SOURCES += $(addprefix
> $(intermediates)/, $(ISL_GENERATED_FILES)
> >  define bash-gen
> >         @mkdir -p $(dir $@)
> >         @echo "Gen Bash: $(PRIVATE_MODULE) <= $(notdir $(@))"
> > -       $(hide) $(PRIVATE_SCRIPT) < $(PRIVATE_CSV) > $@
> > +       $(hide) $(PRIVATE_SCRIPT) --csv $(PRIVATE_CSV) --out
> $(ISL_GENERATED_FILES)
> >  endef
> >
> >  isl_format_layout_deps := \
> > -       $(LOCAL_PATH)/isl_format_layout_gen.bash \
> > +       $(LOCAL_PATH)/gen_format_layout.py \
> >         $(LOCAL_PATH)/isl_format_layout.csv
> >
> > -$(intermediates)/isl_format_layout.c: PRIVATE_SCRIPT := bash -c
> $(LOCAL_PATH)/isl_format_layout_gen.bash
> > +$(intermediates)/isl_format_layout.c: PRIVATE_SCRIPT := $(MESA_PYTHON2)
> $(LOCAL_PATH)/gen_format_layout.py
> >  $(intermediates)/isl_format_layout.c: PRIVATE_CSV :=
> $(LOCAL_PATH)/isl_format_layout.csv
> >  $(intermediates)/isl_format_layout.c: $(isl_format_layout_deps)
> >         $(call bash-gen)
> > diff --git a/src/intel/isl/Makefile.am b/src/intel/isl/Makefile.am
> > index 74f863a..8142932 100644
> > --- a/src/intel/isl/Makefile.am
> > +++ b/src/intel/isl/Makefile.am
> > @@ -1,4 +1,4 @@
> > -# Copyright 2015 Intel Corporation
> > +# Copyright 2015-2016 Intel Corporation
> >  #
> >  # Permission is hereby granted, free of charge, to any person obtaining
> a
> >  # copy of this software and associated documentation files (the
> "Software"),
> > @@ -66,10 +66,13 @@ libisl_gen9_la_CFLAGS = $(libisl_la_CFLAGS)
> -DGEN_VERSIONx10=90
> >
> >  BUILT_SOURCES = $(ISL_GENERATED_FILES)
> >
> > -isl_format_layout.c: isl_format_layout_gen.bash \
> > +PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS)
> > +
> > +isl_format_layout.c: gen_format_layout.py \
> >                       isl_format_layout.csv
> > -       $(AM_V_GEN)$(srcdir)/isl_format_layout_gen.bash \
> > -           <$(srcdir)/isl_format_layout.csv >$@
> > +       $(PYTHON_GEN) $(srcdir)/gen_format_layout.py \
> > +           --csv $(srcdir)/isl_format_layout.csv \
> > +           --out $(srcdir)/isl_format_layout.c
> I'm thinking that this should be builddir/isl_format_layout.c. Then
> again one could/should use $@ in the first place. Both here and in the
> Android case.
>

We usually use builddir in the autotools at least as far as I know.

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

Feel free to CC stable.  It's not a bugfix but if we have to backport
patches to stable, it'll be much easier w/o a bash generator.


>
> Regardless of which option you go for builddir/... or $@ the patch is
> Reviewed-by: Emil Velikov <emil.velikov at collabora.com>
>
> -Emil
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160610/6ddd0b55/attachment-0001.html>


More information about the mesa-dev mailing list