def createMainMod(): printStart("Creating main mod...") cmd = "mmaker -v %s %s" % (xmlfile, modfile) printInfo(cmd) ret = os.system(cmd) printExit("... main mod created!", ret) return ret
def moveFile(source, dest): printStart("Moving file...") cmd = "mv %s %s" % (source, dest) printInfo(cmd) ret = os.system(cmd) printExit("... file moved!", ret) return ret
def cleanDir(dir): printStart("Deleting files from '%s'..." % (dir)) cmd = "rm -f %s" % (dir + "*") printInfo(cmd) ret = os.system(cmd) printExit("... files from '%s' deleted!" % (dir), ret) return ret
def cleanDir(dir): printStart("Deleting files from '%s'..." % (dir)) cmd = "rm -f %s" % (dir+"*") printInfo(cmd) ret = os.system(cmd) printExit("... files from '%s' deleted!" % (dir), ret) return ret
def addExec(source, dest): printStart("Insert exec files...") cmd = "isomorph --add exec %s %s %s" % (execpath + "*", source, dest) printInfo(cmd) ret = os.system(cmd) printExit("... exec files inserted!", ret) source, dest = dest, source return ret, source, dest
def addFile2Copy(file, path, source, dest): printStart("Insert file '%s' to '%s'..." % (file, path)) cmd = "isomorph --add copy %s %s %s %s" % (file, path, source, dest) printInfo(cmd) ret = os.system(cmd) printExit("... file added!", ret) source, dest = dest, source return ret, source, dest
def addMainMod(source, dest): printStart("Insert main mod...") cmd = "isomorph --add main %s %s %s" % (modfile, source, dest) printInfo(cmd) ret = os.system(cmd) printExit("... main mod inserted!", ret) source, dest = dest, source return ret, source, dest
def addExec(source, dest): printStart("Insert exec files...") cmd = "isomorph --add exec %s %s %s" % (execpath+"*", source, dest) printInfo(cmd) ret = os.system(cmd) printExit("... exec files inserted!", ret) source, dest = dest, source return ret, source, dest
def createXML(name, source, dest): printStart("Creating mini mod xml file...") printInfo("opening file '%sMini.xml'..." % (name)) xml = open("%sMini.xml" % (name), "w+") printInfo("writing head to file...") xml.write(createHead(name)) addFiles(xml, os.path.abspath(source), dest) printInfo("writing tail to file...") xml.write(createTail()) printInfo("closing file...") xml.close() printExit("...mini mod xml file created!",0) return
def delContent(source, dest, delete): printStart("Deleting old content...") printInfo("\t... deleting %s" % delete) if delete == "all": cmd = "isomorph --del-all %s %s" % (source, dest) else: cmd = "isomorph --del-all %s %s %s" % (delete, source, dest) printInfo(cmd) ret = os.system(cmd) printExit("... old content deleted!", ret) source, dest = dest, source return ret, source, dest
def addMiniMods(source, dest): printStart("Insert mini mods...") ret = 0 for item in os.listdir(minipath): file = os.path.join(minipath, item) cmd = "isomorph --add mini %s %s %s" % (file, source, dest) printInfo("insert mini mod '%s'..." % (file)) printInfo(cmd) ret = os.system(cmd) source, dest = dest, source if ret != 0: break printExit("... mini mods inserted!", ret) return ret, source, dest
def createMiniMods(): printStart("Creating mini mods...") reg = re.compile(r"^.*Mini\.xml") ret = 0 for item in os.listdir(rootpath): file = os.path.join(rootpath, item) if os.path.isfile(file) or os.path.islink(file): if not reg.match(item): continue printInfo("creating mini mod for '%s'" % (item)) cmd = "morphmini %s %s" % (file, minipath+item.replace("Mini.xml", ".mod")) printInfo(cmd) ret = os.system(cmd) if ret != 0: break printExit("... mini mods created!", ret) return ret
def createMiniMods(): printStart("Creating mini mods...") reg = re.compile(r"^.*Mini\.xml") ret = 0 for item in os.listdir(rootpath): file = os.path.join(rootpath, item) if os.path.isfile(file) or os.path.islink(file): if not reg.match(item): continue printInfo("creating mini mod for '%s'" % (item)) cmd = "morphmini %s %s" % (file, minipath + item.replace("Mini.xml", ".mod")) printInfo(cmd) ret = os.system(cmd) if ret != 0: break printExit("... mini mods created!", ret) return ret