mirror of https://github.com/zulip/zulip.git
run-dev: Replace optparse with argparse.
Tweaked by tabbott to preserve the usage information correctly and remove some duplication.
This commit is contained in:
parent
f6e6e8ba44
commit
e9d35be2bd
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import optparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
import pwd
|
import pwd
|
||||||
import signal
|
import signal
|
||||||
|
@ -28,7 +28,7 @@ if False:
|
||||||
if 'posix' in os.name and os.geteuid() == 0:
|
if 'posix' in os.name and os.geteuid() == 0:
|
||||||
raise RuntimeError("run-dev.py should not be run as root.")
|
raise RuntimeError("run-dev.py should not be run as root.")
|
||||||
|
|
||||||
parser = optparse.OptionParser(r"""
|
parser = argparse.ArgumentParser(description=r"""
|
||||||
|
|
||||||
Starts the app listening on localhost, for local development.
|
Starts the app listening on localhost, for local development.
|
||||||
|
|
||||||
|
@ -40,8 +40,8 @@ which serves to both of them. After it's all up and running, browse to
|
||||||
Note that, while runserver and runtornado have the usual auto-restarting
|
Note that, while runserver and runtornado have the usual auto-restarting
|
||||||
behavior, the reverse proxy itself does *not* automatically restart on changes
|
behavior, the reverse proxy itself does *not* automatically restart on changes
|
||||||
to this file.
|
to this file.
|
||||||
""")
|
""",
|
||||||
|
formatter_class=argparse.RawTextHelpFormatter)
|
||||||
|
|
||||||
TOOLS_DIR = os.path.dirname(os.path.abspath(__file__))
|
TOOLS_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||||
sys.path.insert(0, os.path.dirname(TOOLS_DIR))
|
sys.path.insert(0, os.path.dirname(TOOLS_DIR))
|
||||||
|
@ -49,31 +49,25 @@ from tools.lib.test_script import (
|
||||||
get_provisioning_status,
|
get_provisioning_status,
|
||||||
)
|
)
|
||||||
|
|
||||||
parser.add_option('--test',
|
parser.add_argument('--test',
|
||||||
action='store_true', dest='test',
|
action='store_true',
|
||||||
help='Use the testing database and ports')
|
help='Use the testing database and ports')
|
||||||
|
parser.add_argument('--minify',
|
||||||
parser.add_option('--minify',
|
action='store_true',
|
||||||
action='store_true', dest='minify',
|
|
||||||
help='Minifies assets for testing in dev')
|
help='Minifies assets for testing in dev')
|
||||||
|
parser.add_argument('--interface',
|
||||||
parser.add_option('--interface',
|
action='store',
|
||||||
action='store', dest='interface',
|
|
||||||
default=None, help='Set the IP or hostname for the proxy to listen on')
|
default=None, help='Set the IP or hostname for the proxy to listen on')
|
||||||
|
parser.add_argument('--no-clear-memcached',
|
||||||
parser.add_option('--no-clear-memcached',
|
|
||||||
action='store_false', dest='clear_memcached',
|
action='store_false', dest='clear_memcached',
|
||||||
default=True, help='Do not clear memcached')
|
default=True, help='Do not clear memcached')
|
||||||
|
parser.add_argument('--force',
|
||||||
parser.add_option('--force', dest='force',
|
|
||||||
action="store_true",
|
action="store_true",
|
||||||
default=False, help='Run command despite possible problems.')
|
default=False, help='Run command despite possible problems.')
|
||||||
|
parser.add_argument('--enable-tornado-logging',
|
||||||
parser.add_option('--enable-tornado-logging', dest='enable_tornado_logging',
|
|
||||||
action="store_true",
|
action="store_true",
|
||||||
default=False, help='Enable access logs from tornado proxy server.')
|
default=False, help='Enable access logs from tornado proxy server.')
|
||||||
|
options = parser.parse_args()
|
||||||
(options, arguments) = parser.parse_args()
|
|
||||||
|
|
||||||
if not options.force:
|
if not options.force:
|
||||||
ok, msg = get_provisioning_status()
|
ok, msg = get_provisioning_status()
|
||||||
|
|
Loading…
Reference in New Issue