예제 #1
0
def run_command(args, rc):
    from . import global_logger

    if args.test_library:
        rc.set_lirbary_database('test')

    try:
        from ambry.library import global_library, Library
        global global_library

        l = Library(rc, echo=args.echo)

        global_library = l

        l.logger = global_logger
        l.sync_config()

    except Exception as e:
        if args.subcommand != 'info':
            warn('Failed to instantiate library: {}'.format(e))
        l = None

        if args.exceptions:
            raise

    try:
        globals()['root_' + args.subcommand](args, l, rc)
    except NotFoundError as e:
        if args.exceptions:
            raise
        fatal(e)
    except Exception:
        raise
예제 #2
0
파일: root.py 프로젝트: CivicSpleen/ambry
def run_command(args, rc):
    from . import global_logger

    if args.test_library:
        rc.set_lirbary_database('test')

    try:
        from ambry.library import global_library, Library
        global global_library

        l = Library(rc, echo=args.echo)

        global_library = l

        l.logger = global_logger
        l.sync_config()

    except Exception as e:
        if args.subcommand != 'info':
            warn('Failed to instantiate library: {}'.format(e))
        l = None

        if args.exceptions:
            raise

    try:
        globals()['root_' + args.subcommand](args, l, rc)
    except NotFoundError as e:
        if args.exceptions:
            raise
        fatal(e)
    except Exception:
        raise