#!/usr/bin/env python import optparse, os.path FILENAMES = ["Instrument.py", "Event.py", "Project.py"] def getZPTUndoStrings(filename): file = open(filename) lineList = [] tempLine = None currentLine = file.readline() while currentLine: if currentLine.startswith("\tdef "): tempLine = currentLine elif "undo : " in currentLine and tempLine: lineList.append(stripWhiteSpace(tempLine)) tempLine = None currentLine = file.readline() return lineList def getZPNUndoStrings(filename): file = open(filename) lineList = [] lastWasUndo = None currentLine = file.readline() while currentLine: if currentLine.startswith("\t@UndoSystem.UndoCommand("): lineList.append(stripWhiteSpace(file.readline())) currentLine = file.readline() return lineList def stripWhiteSpace(string): return "".join([x for x in string if not x.isspace()]) if __name__ == "__main__": parser = optparse.OptionParser(usage="%prog [Jokosher 0.9 folder] [Jokosher 0.2 folder]", version="0.9-SVN") (options, args) = parser.parse_args() if not args or len(args) != 2 or (not args[0] or not args[1]): print "Please specify both a Jokosher 0.9 and 0.2 folder." else: ZPNStrings = [] ZPTStrings = [] Terrors = [] for i in FILENAMES: ZPNStrings.append(getZPNUndoStrings(os.path.join(args[0], i))) ZPTStrings.append(getZPTUndoStrings(os.path.join(args[1], i))) print "Jokosher version 0.9 is missing:" for i in range(len(FILENAMES)): for x in ZPTStrings[i]: if not x in ZPNStrings[i]: print FILENAMES[i] + ":", x