[Mesa-dev] Cleaning up Python scripts

Corbin Simpson mostawesomedude at gmail.com
Wed Sep 14 08:26:29 PDT 2011


Hi,

I've talked about it a bit before, but I feel that it's getting out of
hand, so it's time to talk about cleaning up some of the Python that's
used to generate/build Mesa.

First, the biggest problem is that our Python's completely untested
and unstructured. It's very ad-hoc. This might be alright for some of
the codegen, but the rather extensive total weight of all of these
scripts is over 20 KLOCs, and this is just too much code to be
scattered about with very little organization. There are zero Python
packages (folders with __init__.py) in Mesa.

Here are a handful of problems exposed by pyflakes, a minimal static
analysis tool which only catches syntax errors, unused names, and
undefined names. This is really only tip-of-the-iceberg stuff, but I
don't feel comfortable sending patches for this stuff without talking
to the people that wrote this code originally.

 * /src/gallium/drivers/llvmpipe/lp_tile_shuffle_mask.py has a syntax
error in global scope; it can't possibly run.
 * /scons/wcesdk.py has an undefined name in what appears to be dead
code. This probably isn't a problem because I don't think any of us
care about WinCE. (Which leads to the question: Why is this in the
tree?)
 * /src/mapi/glapi/gen/*.py have undefined calls to show_usage(),
which I anticipate should show a usage message and exit. However,
since these are generally only called from Makefiles, they shouldn't
be a problem. Of course, people might have trouble running them
manually...
 * /src/mapi/mapi/mapi_abi.py has a couple more undefined names in error paths.

What are people's opinions on this? Is it worth spending some time to
clean up some of this code?

~ C.

-- 
When the facts change, I change my mind. What do you do, sir? ~ Keynes

Corbin Simpson
<MostAwesomeDude at gmail.com>


More information about the mesa-dev mailing list