def AppBundleMain(argv): b = os.path.basename(argv[0]) main_name, ext = os.path.splitext(b) if main_name in ('opy_', 'opy') and ext: # opy_.py or opy.ovm try: first_arg = argv[1] except IndexError: raise args.UsageError('Missing required applet name.') # TODO: We don't have this if first_arg in ('-h', '--help'): #builtin.Help(['bundle-usage'], util.GetResourceLoader()) raise NotImplementedError('OPy help not implemented') sys.exit(0) if first_arg in ('-V', '--version'): _ShowVersion() sys.exit(0) main_name = first_arg argv0 = argv[1] main_argv = argv[2:] else: argv0 = argv[0] main_argv = argv[1:] if main_name == 'opy': status = OpyMain(argv0, main_argv) return status elif main_name == 'opyc': return opy_main.OpyCommandMain(main_argv) else: raise args.UsageError('Invalid applet name %r.' % main_name)
def AppBundleMain(argv): b = os.path.basename(argv[0]) main_name, ext = os.path.splitext(b) if main_name in ('opy_', 'opy') and ext: # opy_.py or opy.ovm try: first_arg = argv[1] except IndexError: raise error.Usage('Missing required applet name.') main_name = first_arg argv0 = argv[1] main_argv = argv[2:] else: argv0 = argv[0] main_argv = argv[1:] if main_name == 'opyc': return opy_main.OpyCommandMain(main_argv) else: raise error.Usage('Invalid applet name %r.' % main_name)