[Mesa-dev] [PATCH] glapi: Avoid argparse type argument for API XML input files.

Dylan Baker baker.dylan.c at gmail.com
Tue May 26 11:36:22 PDT 2015


On Tue, May 26, 2015 at 02:15:37PM -0400, Ilia Mirkin wrote:
> On Tue, May 26, 2015 at 2:14 PM, Dylan Baker <baker.dylan.c at gmail.com> wrote:
> > On Tue, May 26, 2015 at 02:05:41PM -0400, Ilia Mirkin wrote:
> >> On Tue, May 26, 2015 at 2:06 PM, Dylan Baker <baker.dylan.c at gmail.com> wrote:
> >> > On Tue, May 26, 2015 at 11:15:36AM +0100, Jose Fonseca wrote:
> >> >> argparse type is a nice type saver for simple data types, but it doesn't
> >> >> look a good fit for the input XML file:
> >> >>
> >> >> - Certain implementations of argparse (particularly python 2.7.3's)
> >> >>   invoke the type constructor for the default argument even when an
> >> >>   option is passed in the command line.  Causing `No such file or
> >> >>   directory: 'gl_API.xml'` when the current dir is not
> >> >>   src/mapi/glapi/gen.
> >> >>
> >> > The fix is fine, I'm not complaining about the changes.
> >> >
> >> > However,
> >> >
> >> > I'm running 'scons' against python 2.7.3 and it's building fine with
> >> > your patch reverted. Is there something I'm missing about the way that
> >> > the scons build works? The documentation says that just 'scons' is all
> >> > that is necessary, is that not the case?
> >>
> >> Do an out-of-tree build where gl_API.xml isn't in the current directory.
> >>
> >
> > out-of-tree builds were not brought up in the discussion, I have been
> > working under the assumption of in-tree-builds.
> >
> > I'm also not sure at all how that's relavent, since the scons build
> > doesn't pass absolute paths, so falling back to the default or passing
> > '-f' should come up with the same result.
> >
> > Or did I completely misunderstand what you're saying?
> 
> Not *completely* :) So yes, you're right, out-of-tree builds should
> work. But note my analysis in the bug. Basically argparse will
> evaluate the default value *even if* the argument is overridden (for
> older versions of argparse). So it'll try to load 'gl_API.xml', which
> will either be there or not depending on the cwd of the command. When
> it's an in-tree build, the cwd is the gen dir which has the xml file
> and all's well. When it's an out-of-tree build, the cwd is in your
> side-build tree, and there's no gl_API.xml file there.
> 
> At least that's my understanding of the situation.

Which is what I see when I test 2.6 with Jose's patch reverted (In
tree). What I can't do is replicate the issue in 2.7.3, so I'm trying to
figure out if there's something else I need to do.

It's not even readily obvious how one does an 'out-of-tree' build with
scons, it seems from reading their wiki that this is a completely
foreign concept to scons, these values are all hard coded in the scons
script, unless I'm missing something else.

Ultimately I just want to understand what's going on to avoid further
issues in the future.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150526/dadf8e5e/attachment.sig>


More information about the mesa-dev mailing list