[Mesa-dev] [PATCH] glapi: Reformat python code generation scripts to use 4-space indentation.
kenneth at whitecape.org
Wed Oct 10 08:59:04 PDT 2012
On 10/10/2012 07:55 AM, Paul Berry wrote:
> This brings us into accordance with the official Python style guide
> To preserve the indentation of the c code that is generated by these
> scripts, I've avoided re-indenting triple-quoted strings (unless those
> strings appear to be docstrings).
> I'm about to start doing some work on the Python code generation
> scripts in src/mapi/glapi/gen, and I'd like to use the standard Python
> style of 4-space indentation. Several of us have talked about
> switching to the standard style for a long time, and one of the chief
> stumbling blocks was not wanting to deal with a transitional period
> where the indentation was inconsistent. So yesterday I wrote a script
> to automate the conversion process
> This patch is the result of applying that script to the python files
> in src/mapi/glapi/gen only. I would be happy to apply the script to
> other python files in Mesa (or Piglit) if there is interest.
> I based the algorithm on the Python line structure analysis rules
> (documented in
> so I believe it should not alter any semantics.
> The diff is over 400k, so I've included just two of the smaller python
> files as representative examples. The complete patch can be found at
> git://github.com/stereotype441/mesa.git in branch "reindent-glapi".
I definitely approve of using PEP-8 style.
Acked-by: Kenneth Graunke <kenneth at whitecape.org>
Incidentally, the glsl/builtins scripts are all already 4-space indent.
By the way, have you seen the 'pep8' and 'autopep8' tools? The former
reports any PEP-8 style violations, and the latter attempts to fix them.
I'm curious whether there's any work to be done besides the indentation.
More information about the mesa-dev