def do_patch(self, file): merger = Merger(file) compile = False for p in self.patches: if p._apply: compile = True print("Merging program %s for \"%s\"..." % (p.get_program(), p.name())) f_m = open(p.get_program(), 'r+b') merger.merge(f_m) f_m.close() print("Program %s for \"%s\" merged.\n" % (p.get_program(), p.name())) if compile: print("Compiling ...") merger.compile() print("") for p in self.patches: if p._apply: print("Patching \"%s\"..." % (p.name())) file = p.patch(file) print("") return file