[Mesa-dev] [PATCH] r600/egd_tables.py: make the script python 2+3 compatible

Stefan Dirsch sndirsch at suse.de
Fri Mar 2 11:59:38 UTC 2018


On Fri, Mar 02, 2018 at 11:47:57AM +0000, Eric Engestrom wrote:
> On Friday, 2018-03-02 12:25:11 +0100, Stefan Dirsch wrote:
> > On Fri, Mar 02, 2018 at 11:03:53AM +0000, Eric Engestrom wrote:
> > > On Friday, 2018-03-02 11:41:00 +0100, Stefan Dirsch wrote:
> > > > Patch by "Tomas Chvatal" <tchvatal at suse.com> with modifications
> > > > by "Michal Srb" <msrb at suse.com> to not break python 2.
> > > > 
> > > > https://bugzilla.suse.com/show_bug.cgi?id=1082303
> > > > 
> > > > v2:
> > > > - no longer try to encode a unicode
> > > > - make use of 'from __future__ import print_function', so semantics
> > > >   of print statements in python2 are closer to print functions in python3
> > > > 
> > > > https://lists.freedesktop.org/archives/mesa-dev/2018-February/187056.html
> > > > 
> > > > Signed-off-by: Stefan Dirsch <sndirsch at suse.de>
> > > > Reviewed-by: Tomas Chvatal <tchvatal at suse.com>
> > > > ---
> > > >  src/gallium/drivers/r600/egd_tables.py | 53 +++++++++++++++++-----------------
> > > >  1 file changed, 27 insertions(+), 26 deletions(-)
> > > > 
> > > > diff --git a/src/gallium/drivers/r600/egd_tables.py b/src/gallium/drivers/r600/egd_tables.py
> > > > index d7b78c7fb1..4796456330 100644
> > > > --- a/src/gallium/drivers/r600/egd_tables.py
> > > > +++ b/src/gallium/drivers/r600/egd_tables.py
> > > > @@ -1,3 +1,4 @@
> > > > +from __future__ import print_function
> > > >  
> > > >  CopyRight = '''
> > > >  /*
> > > > @@ -60,7 +61,7 @@ class StringTable:
> > > >          """
> > > >          fragments = [
> > > >              '"%s\\0" /* %s */' % (
> > > > -                te[0].encode('string_escape'),
> > > > +                te[0],
> > > 
> > > I think you still need to escape the string here.
> > 
> > I don't know how to address this. :-( At least the output of
> > 
> >   python2 egd_tables.py evergreend.h
> >   python3 egd_tables.py evergreend.h
> > 
> > is now identical. Surely this may change with changes in content of
> > evergreend.h. :-( Ok. I've tried my best.
> 
> I think you should already land the print() changes, leaving this line
> as is for now. Won't be valid python3 yet, but this will be the last
> thing to fix, which someone else might pick up :)

Leaving the line as is won't run with python3.

> With the string escape hunk left out, this patch is
> Reviewed-by: Eric Engestrom <eric.engestrom at imgtec.com>

Thanks, but I'm not really interested in submitting a patch, which doesn't fix
the build for python3.

Stefan

Public Key available
------------------------------------------------------
Stefan Dirsch (Res. & Dev.)   SUSE LINUX GmbH
Tel: 0911-740 53 0            Maxfeldstraße 5
FAX: 0911-740 53 479          D-90409 Nürnberg
http://www.suse.de            Germany 
---------------------------------------------------------------
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham
Norton, HRB 21284 (AG Nürnberg)
---------------------------------------------------------------


More information about the mesa-dev mailing list