Created
August 13, 2018 04:12
-
-
Save Earthcomputer/7d977283108b49a4710a18de79f9806c to your computer and use it in GitHub Desktop.
Compares to JARs and filters out modified classes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from zipfile import ZipFile | |
import sys | |
if len(sys.argv) < 4: | |
print("python " + sys.argv[0] + " <unchanged.jar> <changed.jar> <output.jar>") | |
else: | |
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 = changed.read(name) | |
if name not in unchanged.namelist(): | |
output.writestr(name, content) | |
elif content != unchanged.read(name): | |
output.writestr(name, content) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment