[Mesa-dev] [PATCH] glapi: Avoid argparse type argument for API XML input files.
imirkin at alum.mit.edu
Tue May 26 11:15:37 PDT 2015
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.
More information about the mesa-dev