Transformation of contrib/check_GNU_style.sh to a python script

Martin Liška mliska@suse.cz
Wed May 24 08:35:00 GMT 2017


On 05/22/2017 09:08 AM, Tom de Vries wrote:
> On 05/19/2017 03:47 PM, Martin Liška wrote:
>> +if __name__ == '__main__':
>> +    if len(sys.argv) > 1:
>> +        main()
>> +    else:
>> +        unittest.main()
> 
> Hi,
> 
> when specifying no arguments to the script, I see:
> ...
> $ ./contrib/check_GNU_style.py
> .
> ----------------------------------------------------------------------
> Ran 1 test in 0.000s
> 
> OK
> ...
> In other words, the unit tests are run.
> 
> I was expecting some form of help message.
> 
> 
> Attached patch splits off a lib file from the script. When running the lib file as a script, we run the unit tests. When running the script without args, we see:
> ...
> $ ./contrib/check_GNU_style.py
> usage: check_GNU_style.py [-h] [-f {stdio,quickfix}] file
> check_GNU_style.py: error: the following arguments are required: file
> ...
> 
> OK?

Hi.

Works for me, good idea!

Martin

> 
> Thanks,
> - Tom



More information about the Gcc mailing list