Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Compares to JARs and filters out modified classes
from zipfile import ZipFile
import sys
if len(sys.argv) < 4:
print("python " + sys.argv[0] + " <unchanged.jar> <changed.jar> <output.jar>")
with ZipFile(sys.argv[1]) as unchanged:
with ZipFile(sys.argv[2]) as changed:
with ZipFile(sys.argv[3], "w") as output:
for name in changed.namelist():
content =
if name not in unchanged.namelist():
output.writestr(name, content)
elif content !=
output.writestr(name, content)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment