コード例 #1
0
ファイル: core.py プロジェクト: wijjo/cmdo
def main(version):
    if public.program.name != public.engine.name and version is not None:
        public.program.version = version
    args = getArgs()
    if public.verbose:
        log_utility.info('args = %s' % args)
    # Load scripts and warn about duplicates
    loadScripts()
    global duplicateFunctions
    if len(duplicateFunctions) > 0:
        duplicateFunctions.sort()
        for dup in duplicateFunctions:
            log_utility.warning('Ignoring duplicate "%s" from "%s"' % (dup.name(), dup.path()))
    # Display the quick start guide if running the base program with no arguments
    if public.engine.name and len(args) == 0:
        execute('help()')
        sys.exit(1)
    for argIn in args:
        try:
            execute(argIn)
        except public.ExcBase, e:
            if e.traceback:
                log_utility._tracebackException(None, e, 0, 0, False)
            else:
                msgs = str(e).split('\n')
                log_utility.error('Command: "%s"' % argIn, *msgs)
        except doc.ExcBase, e:
            msgs = str(e).split('\n')
            log_utility.error('Command: "%s"' % argIn, *msgs)
コード例 #2
0
ファイル: core.py プロジェクト: wijjo/cmdo
        else:
            # Documentation in non-function-bearing modules is added to the "guide"
            if appPrimary.namespace == public.program.namespace:
                props = {'all': name, 'guide': name}
            else:
                props = {}
            if isCore:
                docRegistrar.wrap(form = 'wrapper', core = name, **props)
            else:
                docRegistrar.wrap(form = 'wrapper', module = name, **props)
        docRegistrar.register()

    except public.ExcLoad, e:
        log_utility._tracebackException('Failed to load "%s"' % path, e, 1, 1, False)
    except public.ExcBase, e:
        log_utility.error('Failed to load "%s"' % path, str(e))
    except doc.ExcBase, e:
        log_utility.error('Failed to load "%s" due to documentation error' % path, str(e))
    except Exception, e:
        log_utility._tracebackException('Failed to load "%s"' % path, e, 0, 0, True)

#===============================================================================

# Assumes the primary app is the last one
def loadDocumentation(path, name, *apps):

    assert path

    try:

        if public.verbose: