Transformation of contrib/check_GNU_style.sh to a python script

Tom de Vries Tom_deVries@mentor.com
Mon May 22 07:08:00 GMT 2017


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?

Thanks,
- Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-check_GNU_style.py-print-usage-if-no-file-specified.patch
Type: text/x-patch
Size: 19076 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20170522/2731babe/attachment.bin>


More information about the Gcc mailing list