Catching python syntax errors at build time

Panu Matilainen pmatilai at laiskiainen.org
Fri Feb 20 18:42:39 UTC 2009


On Fri, 20 Feb 2009, Jeremy Katz wrote:

> On Friday, February 20 2009, Daniel P. Berrange said:
>> On Fri, Feb 20, 2009 at 05:36:30PM +0000, Tim Waugh wrote:
>>> It occurred to me that, since we are already byte-compiling Python code
>>> at build time, it is no extra effort to verify that it can be parsed and
>>> fail if not.
>>>
>>> See attached patch.
>>>
>>> Can anyone think of any reason not to do this?
>>
>> If it catches things like the python syntax error in anaconda for today's
>> rawhide compose, that makes installs impossible, then it is well worth it
>
> Yeah, I'm for putting it in.  While it may cause a couple more
> speed-bumps for the rebuild next week, it'll raise our quality in the
> long run and therefore seems like the "right" thing to do

Indeed. Did a couple of basic smoke-tests: anaconda and yum (current F10 
versions) pass without problems, and OTOH a deliberately caused 
indentation error gets trapped:
Compiling 
/home/pmatilai/rpmbuild/BUILDROOT/anaconda-11.4.1.63-1.x86_64/usr/lib/anaconda/lvm.py 
...
Sorry: IndentationError: ('unindent does not match any outer indentation 
level', ('/usr/lib/anaconda/lvm.py', 44, 51, '    if not 
(os.access("/usr/sbin/lvm", os.X_OK) or\n'))

Building to rawhide right now (rpm-4.6.0-6.fc11), do holler if it catches 
something it shouldn't.

 	- Panu -




More information about the fedora-devel-list mailing list