Пример #1
0
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
Пример #2
0
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
Пример #3
0
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
Пример #4
0
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
Пример #5
0
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
Пример #6
0
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
Пример #7
0
def addFiles(xml, source, dest):
	printInfo("adding content from '%s'..." % (source))
	for item in os.listdir(source):
		file = os.path.join(source, item)
		if os.path.isfile(file) or os.path.islink(file):
			printInfo("adding file '%s'..." % (item))
			xml.write(addFile(file, os.path.join(dest, item)))
		elif os.path.isdir(file):
			addFiles(xml, file, os.path.join(dest, item))
Пример #8
0
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
Пример #9
0
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
Пример #10
0
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
Пример #11
0
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
Пример #12
0
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
Пример #13
0
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
Пример #14
0
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
Пример #15
0
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
Пример #16
0
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
Пример #17
0
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
Пример #18
0
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
Пример #19
0
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
Пример #20
0
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