elif o == "-d": dump_only = 1 elif o == "-V": version() sys.exit(0) elif o == "-u" or o == "-h": print_usage = 1 elif o == "-v": verbose = verbose + 1 elif o == "-q": quiet = 1 _omniidl.quiet() elif o == "-p": paths.append(a) elif o == "-i": interactive = 1 elif o == "-T": temp_file = genTempFileName() elif o == "-P": preprocessor_args.extend(_omniidl.platformDefines()) sys.path = paths + sys.path
def parseArgs(args): global preprocessor_args, preprocessor_only, preprocessor_cmd global no_preprocessor, backend, backend_args, dump_only, cd_to global verbose, quiet, print_usage, interactive, temp_file paths = [] try: opts, files = getopt.getopt(args, "D:I:U:EY:NW:b:n:kKC:dVuhvqp:iTP") except getopt.error as e: sys.stderr.write("Error in arguments: -" + e.opt + "\n") sys.stderr.write("Use '" + cmdname + " -u' for usage\n") sys.exit(1) for opt in opts: o, a = opt if o == "-D": preprocessor_args.append("-D" + a) elif o == "-I": if sys.platform != "OpenVMS": preprocessor_args.append('-I "%s"' % a) else: # It would be stupid, rude, and evil to put spaces in # a dirname on VMS preprocessor_args.append('-I%s' % a) elif o == "-U": preprocessor_args.append("-U" + a) elif o == "-E": preprocessor_only = 1 elif o == "-Y": preprocessor_cmd = a elif o == "-N": no_preprocessor = 1 elif o == "-W": if a[0] == "p": preprocessor_args.extend(a[1:].split(",")) elif a[0] == "b": if len(backends) == 0: if not quiet: sys.stderr.write(cmdname + ": Error in arguments: " "no back-ends selected\n") sys.exit(1) backends_args[-1].extend(a[1:].split(",")) else: if not quiet: sys.stderr.write("Error in arguments: option " + o + \ " not recognized\n") sys.stderr.write("Use " + cmdname + " -u for usage\n") sys.exit(1) elif o == "-C": if not os.path.isdir(a): if not quiet: sys.stderr.write(cmdname + ": '" + a + \ "' is not a directory\n") sys.exit(1) cd_to = a elif o == "-b": backends.append(a) backends_args.append([]) elif o == "-n": if a == "f": _omniidl.noForwardWarning() elif a == "c": sys.stderr.write(cmdname + \ ": Warning: -nc option means omniidl will " \ "silently accept invalid IDL.\n") _omniidl.caseSensitive() else: if not quiet: sys.stderr.write(cmdname + \ ": unknown error suppresion option '" + \ a + "'\n") sys.stderr.write("Use " + cmdname + " -u for usage\n") sys.exit(1) elif o == "-k": preprocessor_args.append("-C") _omniidl.keepComments(0) elif o == "-K": preprocessor_args.append("-C") _omniidl.keepComments(1) elif o == "-d": dump_only = 1 elif o == "-V": version() sys.exit(0) elif o == "-u" or o == "-h": print_usage = 1 elif o == "-v": verbose = verbose + 1 elif o == "-q": quiet = 1 _omniidl.quiet() elif o == "-p": paths.append(a) elif o == "-i": interactive = 1 elif o == "-T": temp_file = genTempFileName() elif o == "-P": preprocessor_args.extend(_omniidl.platformDefines()) sys.path = paths + sys.path return files
def parseArgs(args): global preprocessor_args, preprocessor_only, preprocessor_cmd global no_preprocessor, backend, backend_args, dump_only, cd_to global verbose, quiet, print_usage, interactive, temp_file paths = [] try: opts,files = getopt.getopt(args, "D:I:U:EY:NW:b:n:kKC:dVuhvqp:iTP") except getopt.error as e: sys.stderr.write("Error in arguments: -" + e.opt + "\n") sys.stderr.write("Use '" + cmdname + " -u' for usage\n") sys.exit(1) for opt in opts: o,a = opt if o == "-D": preprocessor_args.append("-D" + a) elif o == "-I": if sys.platform != "OpenVMS": preprocessor_args.append('-I "%s"' % a) else: # It would be stupid, rude, and evil to put spaces in # a dirname on VMS preprocessor_args.append('-I%s' % a) elif o == "-U": preprocessor_args.append("-U" + a) elif o == "-E": preprocessor_only = 1 elif o == "-Y": preprocessor_cmd = a elif o == "-N": no_preprocessor = 1 elif o == "-W": if a[0] == "p": preprocessor_args.extend(a[1:].split(",")) elif a[0] == "b": if len(backends) == 0: if not quiet: sys.stderr.write(cmdname + ": Error in arguments: " "no back-ends selected\n") sys.exit(1) backends_args[-1].extend(a[1:].split(",")) else: if not quiet: sys.stderr.write("Error in arguments: option " + o + \ " not recognized\n") sys.stderr.write("Use " + cmdname + " -u for usage\n") sys.exit(1) elif o == "-C": if not os.path.isdir(a): if not quiet: sys.stderr.write(cmdname + ": '" + a + \ "' is not a directory\n") sys.exit(1) cd_to = a elif o == "-b": backends.append(a) backends_args.append([]) elif o == "-n": if a == "f": _omniidl.noForwardWarning() elif a == "c": sys.stderr.write(cmdname + \ ": Warning: -nc option means omniidl will " \ "silently accept invalid IDL.\n") _omniidl.caseSensitive() else: if not quiet: sys.stderr.write(cmdname + \ ": unknown error suppresion option '" + \ a + "'\n") sys.stderr.write("Use " + cmdname + " -u for usage\n") sys.exit(1) elif o == "-k": preprocessor_args.append("-C") _omniidl.keepComments(0) elif o == "-K": preprocessor_args.append("-C") _omniidl.keepComments(1) elif o == "-d": dump_only = 1 elif o == "-V": version() sys.exit(0) elif o == "-u" or o == "-h": print_usage = 1 elif o == "-v": verbose = verbose + 1 elif o == "-q": quiet = 1 _omniidl.quiet() elif o == "-p": paths.append(a) elif o == "-i": interactive = 1 elif o == "-T": temp_file = genTempFileName() elif o == "-P": preprocessor_args.extend(_omniidl.platformDefines()) sys.path = paths + sys.path return files