[Mesa-dev] [PATCH 00/41] glapi python cleanups

Dylan Baker baker.dylan.c at gmail.com
Fri Apr 1 00:04:17 UTC 2016


This is the first part of a much larger project I'm working on to
overhaul the generators. The end goal is to use mako templates rather
than a massive series of print statements, be python 2.7 (the current)
and python 3.3+ (I might be talked into support 3.2 if someone has a
really good case) compatible, and to use the Khronos XML instead of
mesa's hand rolled XML.

Obviously that's a rather large project, and this is ~40 patches to get
started. In general this is style cleanups, removal of deprecated
functionality, usage of python features rather than hand rolling things,
and some cleanups/optimizations in the gl_XML and glX_XML modules, which
are used as modules by most of the generators.

The first set of patches (the ones that are prefaced with just glapi:)
make a single kind of change across all of the python files. I made this
choice since this series was originally more than 100 patches, and
that's just crazy for basic cleanups.

I have verified that this only produces whitespace changes between
master and the tip of this series, and further that piglit shows no
changes between the two.

This is available on freedesktop.org:
git://people.freedesktop.org/~dbaker/mesa wip/glapi-cleanup

I do not have mesa push access.

Dylan Baker (41):
  glapi: clean imports in python files
  glapi: encode python files in utf-8 rather than ascii
  glapi: Update copyright in python files to cover more than IBM
  glapi: remove unnecessary semi-colons in python
  glapi: use python's textwrap.dedent to make code readable
  glapi: normalize python newlines
  glapi: remove useless returns from python code
  glapi: Fix whitespace in python files.
  glapi: fix singleton comparisons to use 'is' in python
  glapi: Don't use string module in python modules
  glapi: remove superflous parens in python
  glapi: have only one statement per line in python files.
  glapi: replace deprecated has_key method in python
  glapi: use xrange instead of range in python
  glapi: remove useless 0 start parameter for (x)range
  glapi: Use booleans in python code.
  glapi: replace RuntimeError with asserts or Exception
  glapi: gl_XML.py: use python's iter() function rather than calling
    __iter__
  glapi: gl_XML.py: remove gl_api.enumIterateByName
  glapi: gl_XML.py: make gl_api.categoryIterate a generator
  glapi: gl_XML.py: simplify gl_api.functionIterateByOffset
  glapi: gl_XML.py: convert gl_api.functionIterateByOffset to a
    generator
  glapi: gl_XML.py: use collections to simplify
    functionsIterateByCategory
  glapi: gl_XML.py: rework gl_api.functionIterateByOffset
  glapi: gl_XML.py: simplify is_attr_true
  glapi: gl_XML.py: avoid unnecessary method call
  glapi: gl_XML.py: store compiled re as a module variable
  glapi: gl_XML.py: add missing method prototype.
  glapi: gl_XML.py: refactor out extra else statement
  glapi: gl_XML.py: return a tuple from gl_parameter.get_dimensions
  glapi: glX_proto_common.py: return variable from
    glx_print_proto.size_call
  glapi: glX_proto_common.py: remove commented out code.
  glapi: glX_proto_common.py: use python's _ for unused values
  glapi: glX_proto_send.py: don't unpack useless values.
  glapi: glX_proto_send.py: Don't shadow builtins.
  glapi: glX_proto_send.py: remove useless pass keyword
  glapi: glX_proto_send.py: simplify XCB string conversion
  glapi: glX_proto_size.py: Remove dead code.
  glapi: glX_server_table.py: use math.log instead of hand coded log2
    function
  glapi: gl_x86_asm.py: simplify method with sum and generator
  glapi: gl_x86-64_asm.py: use _ for unused variable

 src/mapi/glapi/gen/apiexec.py          |    5 +-
 src/mapi/glapi/gen/glX_XML.py          |  141 +-
 src/mapi/glapi/gen/glX_proto_common.py |   23 +-
 src/mapi/glapi/gen/glX_proto_recv.py   |  100 +-
 src/mapi/glapi/gen/glX_proto_send.py   |  653 ++++-----
 src/mapi/glapi/gen/glX_proto_size.py   |  272 ++--
 src/mapi/glapi/gen/glX_server_table.py |   78 +-
 src/mapi/glapi/gen/gl_SPARC_asm.py     |   21 +-
 src/mapi/glapi/gen/gl_XML.py           |  517 +++----
 src/mapi/glapi/gen/gl_apitemp.py       |  192 ++-
 src/mapi/glapi/gen/gl_enums.py         |  190 ++-
 src/mapi/glapi/gen/gl_genexec.py       |   12 +-
 src/mapi/glapi/gen/gl_gentable.py      |   38 +-
 src/mapi/glapi/gen/gl_procs.py         |   70 +-
 src/mapi/glapi/gen/gl_table.py         |   47 +-
 src/mapi/glapi/gen/gl_x86-64_asm.py    |   41 +-
 src/mapi/glapi/gen/gl_x86_asm.py       |   36 +-
 src/mapi/glapi/gen/license.py          |    6 +-
 src/mapi/glapi/gen/remap_helper.py     |   16 +-
 src/mapi/glapi/gen/static_data.py      | 2471 ++++++++++++++++----------------
 src/mapi/glapi/gen/typeexpr.py         |  120 +-
 21 files changed, 2322 insertions(+), 2727 deletions(-)

-- 
2.8.0



More information about the mesa-dev mailing list