Пример #1
0
def buildmodules(lst):
    cfuncs.buildcfuncs()
    outmess('Building modules...\n')
    modules, mnames, isusedby = [], [], {}
    for i in range(len(lst)):
        if '__user__' in lst[i]['name']:
            cb_rules.buildcallbacks(lst[i])
        else:
            if 'use' in lst[i]:
                for u in lst[i]['use'].keys():
                    if u not in isusedby:
                        isusedby[u] = []
                    isusedby[u].append(lst[i]['name'])
            modules.append(lst[i])
            mnames.append(lst[i]['name'])
    ret = {}
    for i in range(len(mnames)):
        if mnames[i] in isusedby:
            outmess('\tSkipping module "%s" which is used by %s.\n' %
                    (mnames[i], ','.join(
                        map(lambda s: '"%s"' % s, isusedby[mnames[i]]))))
        else:
            um = []
            if 'use' in modules[i]:
                for u in modules[i]['use'].keys():
                    if u in isusedby and u in mnames:
                        um.append(modules[mnames.index(u)])
                    else:
                        outmess(
                            '\tModule "%s" uses nonexisting "%s" which will be ignored.\n'
                            % (mnames[i], u))
            ret[mnames[i]] = {}
            dict_append(ret[mnames[i]], rules.buildmodule(modules[i], um))
    return ret
Пример #2
0
def buildmodules(list):
    cfuncs.buildcfuncs()
    outmess('Building modules...\n')
    modules, mnames, isusedby = [], [], {}
    for i in range(len(list)):
        if string.find(list[i]['name'], '__user__') >= 0:
            cb_rules.buildcallbacks(list[i])
        else:
            if list[i].has_key('use'):
                for u in list[i]['use'].keys():
                    if not isusedby.has_key(u): isusedby[u] = []
                    isusedby[u].append(list[i]['name'])
            modules.append(list[i])
            mnames.append(list[i]['name'])
    ret = {}
    for i in range(len(mnames)):
        if isusedby.has_key(mnames[i]):
            outmess('\tSkipping module "%s" which is used by %s.\n' %
                    (mnames[i],
                     string.join(
                         map(lambda s: '"%s"' % s, isusedby[mnames[i]]), ',')))
        else:
            um = []
            if modules[i].has_key('use'):
                for u in modules[i]['use'].keys():
                    if isusedby.has_key(u) and u in mnames:
                        um.append(modules[mnames.index(u)])
                    else:
                        outmess(
                            '\tModule "%s" uses nonexisting "%s" which will be ignored.\n'
                            % (mnames[i], u))
            ret[mnames[i]] = {}
            dict_append(ret[mnames[i]], rules.buildmodule(modules[i], um))
    return ret
Пример #3
0
def buildmodules(lst):
    cfuncs.buildcfuncs()
    outmess("Building modules...\n")
    modules, mnames, isusedby = [], [], {}
    for i in range(len(lst)):
        if "__user__" in lst[i]["name"]:
            cb_rules.buildcallbacks(lst[i])
        else:
            if "use" in lst[i]:
                for u in lst[i]["use"].keys():
                    if u not in isusedby:
                        isusedby[u] = []
                    isusedby[u].append(lst[i]["name"])
            modules.append(lst[i])
            mnames.append(lst[i]["name"])
    ret = {}
    for i in range(len(mnames)):
        if mnames[i] in isusedby:
            outmess(
                '\tSkipping module "%s" which is used by %s.\n'
                % (mnames[i], ",".join(map(lambda s: '"%s"' % s, isusedby[mnames[i]])))
            )
        else:
            um = []
            if "use" in modules[i]:
                for u in modules[i]["use"].keys():
                    if u in isusedby and u in mnames:
                        um.append(modules[mnames.index(u)])
                    else:
                        outmess('\tModule "%s" uses nonexisting "%s" which will be ignored.\n' % (mnames[i], u))
            ret[mnames[i]] = {}
            dict_append(ret[mnames[i]], rules.buildmodule(modules[i], um))
    return ret
Пример #4
0
def buildmodules(list):
    cfuncs.buildcfuncs()
    outmess('Building modules...\n')
    modules,mnames,isusedby=[],[],{}
    for i in range(len(list)):
        if string.find(list[i]['name'],'__user__')>=0:
            cb_rules.buildcallbacks(list[i])
        else:
            if list[i].has_key('use'):
                for u in list[i]['use'].keys():
                    if not isusedby.has_key(u): isusedby[u]=[]
                    isusedby[u].append(list[i]['name'])
            modules.append(list[i])
            mnames.append(list[i]['name'])
    ret = {}
    for i in range(len(mnames)):
        if isusedby.has_key(mnames[i]):
            outmess('\tSkipping module "%s" which is used by %s.\n'%(mnames[i],string.join(map(lambda s:'"%s"'%s,isusedby[mnames[i]]),',')))
        else:
            um=[]
            if modules[i].has_key('use'):
                for u in modules[i]['use'].keys():
                    if isusedby.has_key(u) and u in mnames:
                        um.append(modules[mnames.index(u)])
                    else:
                        outmess('\tModule "%s" uses nonexisting "%s" which will be ignored.\n'%(mnames[i],u))
            ret[mnames[i]] = {}
            dict_append(ret[mnames[i]],rules.buildmodule(modules[i],um))
    return ret