defParseOptions(argv, docstring, extra_opts="", extra_long_opts=(), extra_option_handler=None):
try:
opts, args=getopt.getopt(
argv,"hvp:s:x"+extra_opts,
["help","verbose","path=","signapk_path=","extra_signapk_args=","java_path=","public_key_suffix=","private_key_suffix=","device_specific=","extra="]+list(extra_long_opts))
exceptgetopt.GetoptError, err:
Usage(docstring)
print"**",str(err),"**"
sys.exit(2)
path_specified=False
foro, ainopts:
ifoin("-h","--help"):
Usage(docstring)
sys.exit()
elifoin("-v","--verbose"):
OPTIONS.verbose=True
elifoin("-p","--path"):
OPTIONS.search_path=a
elifoin("--signapk_path",):
OPTIONS.signapk_path=a
elifoin("--extra_singapk_args",):
OPTIONS.extra_signapk_args=shlex.split(a)
elifoin("--java_path",):
OPTIONS.java_path=a
else:
ifextra_option_handlerisNoneornotextra_option_handler(o, a):
assertFalse,"unknown option "%s""%(o,)
os.environ["PATH"]=(os.path.join(OPTIONS.search_path,"bin")+os.pathsep+os.environ["PATH"])
returnargs