This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Transformation of contrib/check_GNU_style.sh to a python script


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]