Set a default value for arguments of cubicweb.cwctl:run()
authorDenis Laxalde <denis.laxalde@logilab.fr>
Wed, 24 Jan 2018 13:30:50 +0100
changeset 12253 9165f4b7426b
parent 12252 64c4edac1706
child 12254 2060ee44ea9a
Set a default value for arguments of cubicweb.cwctl:run() This will help making a console script entry point from this to get rid of the custom installation of scripts in setup.py. Accordingly, update all calls of this function.
bin/cubicweb-ctl
cubicweb/__main__.py
cubicweb/cwctl.py
--- a/bin/cubicweb-ctl	Wed Jan 24 11:34:44 2018 +0100
+++ b/bin/cubicweb-ctl	Wed Jan 24 13:30:50 2018 +0100
@@ -1,4 +1,3 @@
 #!/usr/bin/env python
 from cubicweb.cwctl import run
-import sys
-run(sys.argv[1:])
+run()
--- a/cubicweb/__main__.py	Wed Jan 24 11:34:44 2018 +0100
+++ b/cubicweb/__main__.py	Wed Jan 24 13:30:50 2018 +0100
@@ -1,4 +1,3 @@
 from cubicweb.cwctl import run
-import sys
 
-run(sys.argv[1:])
+run()
--- a/cubicweb/cwctl.py	Wed Jan 24 11:34:44 2018 +0100
+++ b/cubicweb/cwctl.py	Wed Jan 24 13:30:50 2018 +0100
@@ -1078,7 +1078,7 @@
 
 
 
-def run(args):
+def run(args=sys.argv[1:]):
     """command line tool"""
     import os
     filterwarnings('default', category=DeprecationWarning)
@@ -1093,4 +1093,4 @@
         sys.exit(2)
 
 if __name__ == '__main__':
-    run(sys.argv[1:])
+    run()