Ejemplo n.º 1
0
def main():
    content = modanalyzer.load()

    for kind in getKinds(content):
        print
        print "*" * (len(kind) + 4)
        print "*", kind, "*"
        print "*" * (len(kind) + 4)
        showSlice(sliceAcross(content, kind))
Ejemplo n.º 2
0
def main():
    preferredIDs = loadNEIDump()

    contents = modanalyzer.load()
    contents = filterItemBlocks(contents)

    wantedMods = getWantedMods()
    sortedMods = [x for x in sortAllMods(contents) if x in wantedMods]

    resolutionsByKind = {}
    vanilla = "Minecraft-" + modanalyzer.MC_VERSION
    for kind in CHECK_CONFLICT_KINDS:
        resolutionsByKind[kind] = getConflictResolutions(contents, kind, sortedMods+[vanilla], preferredIDs)
    #print "FINAL RES",
    #pprint.pprint(resolutionsByKind)

    modsFolder, coremodsFolder, configFolder = modanalyzer.prepareCleanServerFolders(modanalyzer.TEST_SERVER_ROOT)

    requiresManual = {}
    for modName in sortedMods:
        mod = os.path.join(modanalyzer.ALL_MODS_DIR, modName)

        if not contents.has_key(os.path.basename(mod)+".csv"):
            print "No mod analysis found for %s, please analyze" % (mod,)
            sys.exit(-1)

        print "Installing",mod
        modanalyzer.installMod(mod, modsFolder, coremodsFolder)

        # extract the resolutions we care about, for editing the config
        modEdits = []
        for kind, resolutions in resolutionsByKind.iteritems():
            for (thisMod, defaultId), assignedId in resolutions.iteritems():
                if os.path.basename(mod)+".csv" == thisMod:
                    if assignedId is not None and assignedId != defaultId: # only if changed
                        modEdits.append((mod, kind, defaultId, assignedId))
        #print "MODEDITS=",modEdits 

        pendingEdits = installModConfigs(mod, modEdits)
        if len(pendingEdits) > 0:
            requiresManual[mod] = pendingEdits

    if len(requiresManual) > 0:
        print "=" * 70
        for m, edits in requiresManual.iteritems():
            print m, "\t", " ".join([x[1] for x in getConfigFiles(m)]), "\t", edits
        print "=" * 70
        print "The above mods require manual configuration file editing to continue."
        print "Edit their configs appropriately (search for 'TODO'), then start the server."
    else:
        print "Ready to go..."
        modanalyzer.runServer()