[Mesa-dev] Cleaning up Python scripts

Jose Fonseca jfonseca at vmware.com
Wed Sep 14 09:02:30 PDT 2011



----- Original Message -----
> 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?)

Removed.

>  * /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...

Removed.

Thanks.

>  * /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?

It's hard to say...

A lot of this code is disjoint anyway, so it wouldn't make sense trying to share code between unrelated scripts.

It might be better to do cleanup of the scripts based on pain points, rather than make it a goal on itself. That is, which python code people touched recently and felt that could be cleaned up?



Jose


More information about the mesa-dev mailing list