Esempio n. 1
0
def main():
    assert not we_are_translated()
    driver = TranslationDriver()
    optiondescr = get_additional_config_options()
    config = get_combined_translation_config(
                optiondescr,
                existing_config=driver.config,
                translating=True)
    driver.config = config
    tgt = target(driver, [])
    try:
        f, _1, _2  = tgt
    except TypeError:
        f = tgt
    except ValueError:
        f, _ =  tgt

    try:
        sys.exit(f(sys.argv))
    except SystemExit:
        raise
    except:
        _type, value, tb = sys.exc_info()
        traceback.print_exception(_type, value, tb)
        pdb.post_mortem(tb)
Esempio n. 2
0
def print_help(config):
    to_optparse(config).print_help()


take_options = True


def get_additional_config_options():
    return system.translation_options()


if __name__ == '__main__':
    assert not objectmodel.we_are_translated()
    from rpython.translator.driver import TranslationDriver
    driver = TranslationDriver()
    driver.config = get_combined_translation_config(
        system.translation_options(), translating=False)
    if "--" in sys.argv:
        idx = sys.argv.index("--")
        configargs, args = sys.argv[0:idx], sys.argv[idx:]
    else:
        configargs, args = [], sys.argv
    f, _, _ = target(driver, configargs)
    try:
        sys.exit(f(args))
    except SystemExit:
        pass
    except:
        if hasattr(sys, 'ps1') or not sys.stderr.isatty():
            # we are in interactive mode or we don't have a tty-like
            # device, so we call the default hook
            sys.__excepthook__(type, value, tb)
Esempio n. 3
0
def print_help(config):
    to_optparse(config).print_help()

take_options = True

def get_additional_config_options():
    return system.translation_options()


if __name__ == '__main__':
    assert not objectmodel.we_are_translated()
    from rpython.translator.driver import TranslationDriver
    driver = TranslationDriver()
    driver.config = get_combined_translation_config(
        system.translation_options(),
        translating=False)
    if "--" in sys.argv:
        idx = sys.argv.index("--")
        configargs, args = sys.argv[0:idx], sys.argv[idx:]
    else:
        configargs, args = [], sys.argv
    f, _, _ = target(driver, configargs)
    try:
        sys.exit(f(args))
    except SystemExit:
        pass
    except:
        if hasattr(sys, 'ps1') or not sys.stderr.isatty():
            # we are in interactive mode or we don't have a tty-like
            # device, so we call the default hook