diff options
author | Zachary Turner <zturner@google.com> | 2015-12-02 19:00:52 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2015-12-02 19:00:52 +0000 |
commit | 7cc447763765f96b8d525e3074e44af7f6922879 (patch) | |
tree | 6261c1047d56076bd00183187aa0122b1823b885 /lldb/scripts/swig_bot_lib | |
parent | cf6a8bfe51de71b8c0b6c25fd6622e10f0103faf (diff) | |
download | bcm5719-llvm-7cc447763765f96b8d525e3074e44af7f6922879.tar.gz bcm5719-llvm-7cc447763765f96b8d525e3074e44af7f6922879.zip |
Use sub-commands instead of --mode={client,server}.
This is more pythonic and allows a more idiomatic way of getting
detailed usage information for each individual sub-command.
llvm-svn: 254533
Diffstat (limited to 'lldb/scripts/swig_bot_lib')
-rw-r--r-- | lldb/scripts/swig_bot_lib/client.py | 14 | ||||
-rw-r--r-- | lldb/scripts/swig_bot_lib/server.py | 12 |
2 files changed, 7 insertions, 19 deletions
diff --git a/lldb/scripts/swig_bot_lib/client.py b/lldb/scripts/swig_bot_lib/client.py index 74c9f163388..9bf55b42b66 100644 --- a/lldb/scripts/swig_bot_lib/client.py +++ b/lldb/scripts/swig_bot_lib/client.py @@ -30,7 +30,7 @@ from . import remote default_ip = "127.0.0.1" default_port = 8537 -def process_args(args): +def add_subparser_args(parser): """Returns options processed from the provided command line. @param args the command line to process. @@ -75,10 +75,6 @@ def process_args(args): raise ValueError("Invalid connection string") setattr(namespace, self.dest, ip_port) - # Setup the parser arguments that are accepted. - parser = argparse.ArgumentParser( - description='Generate SWIG bindings.') - parser.add_argument( "--local", action=FindLocalSwigAction, @@ -112,9 +108,7 @@ def process_args(args): action="append", help="Specifies the language to generate bindings for") - # Process args. - options = parser.parse_args(args) - +def finalize_subparser_options(options): if options.languages is None: options.languages = ['python'] @@ -173,9 +167,7 @@ def handle_response(options, connection, response): finally: os.unlink(response_file_path) -def run(args): - options = process_args(args) - +def run(options): if options.remote is None: logging.info("swig bot client using local swig installation at '{}'" .format(options.swig_executable)) diff --git a/lldb/scripts/swig_bot_lib/server.py b/lldb/scripts/swig_bot_lib/server.py index f83e0be44a5..cc25cee4d4b 100644 --- a/lldb/scripts/swig_bot_lib/server.py +++ b/lldb/scripts/swig_bot_lib/server.py @@ -33,10 +33,7 @@ from . import remote default_port = 8537 -def process_args(args): - # Setup the parser arguments that are accepted. - parser = argparse.ArgumentParser(description='SWIG generation server.') - +def add_subparser_args(parser): parser.add_argument( "--port", action="store", @@ -49,8 +46,8 @@ def process_args(args): default=fs.find_executable("swig"), dest="swig_executable") - # Process args. - return parser.parse_args(args) +def finalize_subparser_options(options): + pass def initialize_listening_socket(options): logging.debug("Creating socket...") @@ -134,8 +131,7 @@ def accept_loop(sock, options): logging.error("An error occurred while processing the connection.") logging.error(error) -def run(args): - options = process_args(args) +def run(options): print(options) sock = initialize_listening_socket(options) accept_loop(sock, options) |