[Mesa-dev] [PATCH 12/14] util/gen_xmlpool: Don't write via shell redirection

Dylan Baker dylan at pnwbakers.com
Wed Oct 31 18:53:03 UTC 2018

Quoting Emil Velikov (2018-10-31 11:18:18)
> On Fri, 26 Oct 2018 at 18:25, Dylan Baker <dylan at pnwbakers.com> wrote:
> >
> > This is bad for a couple of reasons, but the worst is that it gets the
> > shell involved. When the shell gets involved we can start running into
> > problems with LANG, namely LANG=C. This is particularly obnoxious for
> > translation files, since there is a very high likelyhood of running into
> > unicode in them. If we write it in python through file.write we don't
> > have this problem as python just shovels bits into a file, and the shell
> > doesn't know, and thus doesn't care.
> In case you want to omit the "inspiring" unicode topic, one could also use:
> Since we use python to generate the code/data, simply write it to a
> file. There's no point in printing it to stdout only to redirect
> stdout to a file.
> Bonus points: the python and build system code is shorter and easier to read.
> > @@ -166,6 +156,7 @@ reDESC_END = re.compile(r'\s*DRI_CONF_DESC_END')
> >  def main():
> >      parser = argparse.ArgumentParser()
> >      parser.add_argument('template')
> > +    parser.add_argument('outfile')
> Since the existing invocation and order is pretty random and magical,
> I'd reuse the approach from rest of mesa
> The below will make things dead obvious. We could handle the rest as
> well... but not a priority IMHO.
> parser.add_argument('-o', '--output', type=str ...., required=True)

I've made the changes, I'm running through our CI again just to make sure
everything's good then I'll push. I'd really like to get this in for 18.3.


> With the argument tweak (and invocations updated of course)
> Reviewed-by: Emil Velikov <emil.velikov at collabora.com>
> -Emil
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20181031/03495189/attachment.sig>

More information about the mesa-dev mailing list