build / tools/releasetools/common.py
def ParseOptions(argv, docstring, extra_opts="", extra_long_opts=(), extra_option_handler=None): """Parse the options in argv and return any arguments that aren't flags. docstring is the calling module's docstring, to be displayed for errors and -h. extra_opts and extra_long_opts are for flags defined by the caller, which are processed by passing them to extra_option_handler.""" try: opts, args = getopt.getopt( argv, "hvp:s:x:" + extra_opts, ["help", "verbose", "path=", "signapk_path=", "extra_signapk_args=", "java_path=", "java_args=", "public_key_suffix=", "private_key_suffix=", "boot_signer_path=", "boot_signer_args=", "verity_signer_path=", "verity_signer_args=", "device_specific=", "extra="] + list(extra_long_opts)) print("1begin") for i in range(len(opts)): print(opts[i]) print("2--") for i in range(len(args)): print(args[i]) print("3end") except getopt.GetoptError as err: Usage(docstring) print "**", str(err), "**" sys.exit(2)