On Wed, 2010-10-27 at 08:50 -0700, Vinson Lee wrote: > > > -----Original Message----- > > From: mesa-dev-bounces+vlee=vmware....@lists.freedesktop.org [mailto:mesa- > > dev-bounces+vlee=vmware....@lists.freedesktop.org] On Behalf Of José > > Fonseca > > Sent: Wednesday, October 27, 2010 8:33 AM > > To: Matthew William Cox > > Cc: mesa-dev@lists.freedesktop.org > > Subject: Re: [Mesa-dev] [PATCH] Fix usage of Python in Makefiles > > > > On Tue, 2010-10-26 at 16:12 -0700, Matthew William Cox wrote: > > > Hello, > > > > > > Firstly, Kenneth Graunke's patch fixes the autoconf issue and supercedes > > > this patch, so we should focus the review on that patch. > > > > > > On Tue, Oct 26, 2010 at 06:23:00AM -0700, Dan Nicholson wrote: > > > > However, removing the second -O from PYTHON_FLAGS is really a separate > > > > change. Can you explain that problem in more detail? > > > > > > The second -O flag triggers the same behaviour as passing -OO to the > > > python interpreter. A single -O enables optimizations, but -OO causes > > > doc strings to be stripped from the bytecode in addition to enabling > > > optimization. There's no real reason to do this, except perhaps to save > > > a small amount of memory. > > > > > > This breaks u_format_srgb.py because that script uses its docstring as > > > part of its output, specifically, the copyright notice of the module is > > > copied to the output. If the docstring is stripped, this causes an > > > exception as the __doc__ variable is undefined. > > > > > > > It might also be more reasonable to just drop $(PYTHON_FLAGS) when > > > > using src/gallium/auxiliary/util/u_format_srgb.py so this isn't a > > > > global change. > > > > > > There's really no global effect to dropping the second -O, and it's more > > > consistent to use the same flags for everything. Why introduce a special > > > case? > > > > Another alternative would be to use a regular string instead of a > > docstring, ie: > > > > diff --git a/src/gallium/auxiliary/util/u_format_srgb.py > > b/src/gallium/auxiliary/util/u_format_srgb.py > > index 3e8000f..3c49458 100644 > > --- a/src/gallium/auxiliary/util/u_format_srgb.py > > +++ b/src/gallium/auxiliary/util/u_format_srgb.py > > @@ -1,6 +1,6 @@ > > #!/usr/bin/env python > > > > -''' > > +copyright = ''' > > > > /************************************************************************* > > * > > * > > * Copyright 2010 VMware, Inc. > > @@ -89,7 +89,7 @@ def main(): > > print '/* This file is autogenerated by u_format_srgb.py. Do not > > edit directly. */' > > print > > # This will print the copyright message on the top of this file > > - print __doc__.strip() > > + print copyright.strip() > > print > > print '#include "u_format_srgb.h"' > > print > > > > It really doesn't affect readability, and avoids this dependency on the > > -O. > > > > There are a few other __doc__ uses. If this works for you I can submit a > > patch that fixes them all. > > > > Jose > > > > _______________________________________________ > > mesa-dev mailing list > > mesa-dev@lists.freedesktop.org > > http://lists.freedesktop.org/mailman/listinfo/mesa-dev > > > 'copyright' is a built-in Python variable. The Python documentation suggests > not to shadow this variable name.
Didn't know that. Thanks. I'll use another variable then. Jose _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev