<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2018-03-02 12:59 GMT+01:00 Stefan Dirsch <span dir="ltr"><<a href="mailto:sndirsch@suse.de" target="_blank">sndirsch@suse.de</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Fri, Mar 02, 2018 at 11:47:57AM +0000, Eric Engestrom wrote:<br>
> On Friday, 2018-03-02 12:25:11 +0100, Stefan Dirsch wrote:<br>
> > On Fri, Mar 02, 2018 at 11:03:53AM +0000, Eric Engestrom wrote:<br>
> > > On Friday, 2018-03-02 11:41:00 +0100, Stefan Dirsch wrote:<br>
> > > > Patch by "Tomas Chvatal" <<a href="mailto:tchvatal@suse.com">tchvatal@suse.com</a>> with modifications<br>
> > > > by "Michal Srb" <<a href="mailto:msrb@suse.com">msrb@suse.com</a>> to not break python 2.<br>
> > > ><br>
> > > > <a href="https://bugzilla.suse.com/show_bug.cgi?id=1082303" rel="noreferrer" target="_blank">https://bugzilla.suse.com/<wbr>show_bug.cgi?id=1082303</a><br>
> > > ><br>
> > > > v2:<br>
> > > > - no longer try to encode a unicode<br>
> > > > - make use of 'from __future__ import print_function', so semantics<br>
> > > >   of print statements in python2 are closer to print functions in python3<br>
> > > ><br>
> > > > <a href="https://lists.freedesktop.org/archives/mesa-dev/2018-February/187056.html" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>archives/mesa-dev/2018-<wbr>February/187056.html</a><br>
> > > ><br>
> > > > Signed-off-by: Stefan Dirsch <<a href="mailto:sndirsch@suse.de">sndirsch@suse.de</a>><br>
> > > > Reviewed-by: Tomas Chvatal <<a href="mailto:tchvatal@suse.com">tchvatal@suse.com</a>><br>
> > > > ---<br>
> > > >  src/gallium/drivers/r600/egd_<wbr>tables.py | 53 +++++++++++++++++-------------<wbr>----<br>
> > > >  1 file changed, 27 insertions(+), 26 deletions(-)<br>
> > > ><br>
> > > > diff --git a/src/gallium/drivers/r600/<wbr>egd_tables.py b/src/gallium/drivers/r600/<wbr>egd_tables.py<br>
> > > > index d7b78c7fb1..4796456330 100644<br>
> > > > --- a/src/gallium/drivers/r600/<wbr>egd_tables.py<br>
> > > > +++ b/src/gallium/drivers/r600/<wbr>egd_tables.py<br>
> > > > @@ -1,3 +1,4 @@<br>
> > > > +from __future__ import print_function<br>
> > > ><br>
> > > >  CopyRight = '''<br>
> > > >  /*<br>
> > > > @@ -60,7 +61,7 @@ class StringTable:<br>
> > > >          """<br>
> > > >          fragments = [<br>
> > > >              '"%s\\0" /* %s */' % (<br>
> > > > -                te[0].encode('string_escape'),<br>
> > > > +                te[0],<br></div></div></blockquote><div><br></div><div>Hi,</div><div><br></div><div>I am not an expert in Python 3, but I have found the following answer experimentally.</div><div><br></div><div>I think the original version is semi-correct, but the encode() method returns a bytes object which we need to convert to unicode. I think the following would be fine:</div><div><br></div><div>te[0].encode('unicode_escape').decode('utf-8')</div><div><br></div><div>Regards,</div><div>Gustaw Smolarczyk</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">
> > ><br>
> > > I think you still need to escape the string here.<br>
> ><br>
> > I don't know how to address this. :-( At least the output of<br>
> ><br>
> >   python2 egd_tables.py evergreend.h<br>
> >   python3 egd_tables.py evergreend.h<br>
> ><br>
> > is now identical. Surely this may change with changes in content of<br>
> > evergreend.h. :-( Ok. I've tried my best.<br>
><br>
> I think you should already land the print() changes, leaving this line<br>
> as is for now. Won't be valid python3 yet, but this will be the last<br>
> thing to fix, which someone else might pick up :)<br>
<br>
</div></div>Leaving the line as is won't run with python3.<br>
<span class=""><br>
> With the string escape hunk left out, this patch is<br>
> Reviewed-by: Eric Engestrom <<a href="mailto:eric.engestrom@imgtec.com">eric.engestrom@imgtec.com</a>><br>
<br>
</span>Thanks, but I'm not really interested in submitting a patch, which doesn't fix<br>
the build for python3.<br>
<div class="HOEnZb"><div class="h5"><br>
Stefan<br>
<br>
Public Key available<br>
------------------------------<wbr>------------------------<br>
Stefan Dirsch (Res. & Dev.)   SUSE LINUX GmbH<br>
Tel: 0911-740 53 0            Maxfeldstraße 5<br>
FAX: 0911-740 53 479          D-90409 Nürnberg<br>
<a href="http://www.suse.de" rel="noreferrer" target="_blank">http://www.suse.de</a>            Germany<br>
------------------------------<wbr>------------------------------<wbr>---<br>
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham<br>
Norton, HRB 21284 (AG Nürnberg)<br>
------------------------------<wbr>------------------------------<wbr>---<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</div></div></blockquote></div><br></div></div>