summaryrefslogtreecommitdiffstats
path: root/Tools/msi/generate_md5.py
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2015-04-06 01:42:37 (GMT)
committerSteve Dower <steve.dower@microsoft.com>2015-04-06 01:42:37 (GMT)
commit7b8c5f58aa1b8ef1b5deb1db6e014e31d0c6d2b6 (patch)
tree5797c7279f25de09b5b3c09c47fa30f6a158e933 /Tools/msi/generate_md5.py
parent79a6ccad5357d03748a941d69a436ec0643591ff (diff)
downloadcpython-7b8c5f58aa1b8ef1b5deb1db6e014e31d0c6d2b6.zip
cpython-7b8c5f58aa1b8ef1b5deb1db6e014e31d0c6d2b6.tar.gz
cpython-7b8c5f58aa1b8ef1b5deb1db6e014e31d0c6d2b6.tar.bz2
Updates Windows release scripts to generate and upload GPG signatures.
Diffstat (limited to 'Tools/msi/generate_md5.py')
-rw-r--r--Tools/msi/generate_md5.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/Tools/msi/generate_md5.py b/Tools/msi/generate_md5.py
new file mode 100644
index 0000000..9e4c147
--- /dev/null
+++ b/Tools/msi/generate_md5.py
@@ -0,0 +1,27 @@
+import hashlib
+import os
+import sys
+
+def main():
+ filenames, hashes, sizes = [], [], []
+
+ for file in sys.argv[1:]:
+ if not os.path.isfile(file):
+ continue
+
+ with open(file, 'rb') as f:
+ data = f.read()
+ md5 = hashlib.md5()
+ md5.update(data)
+ filenames.append(os.path.split(file)[1])
+ hashes.append(md5.hexdigest())
+ sizes.append(str(len(data)))
+
+ print('{:40s} {:<32s} {:<9s}'.format('File', 'MD5', 'Size'))
+ for f, h, s in zip(filenames, hashes, sizes):
+ print('{:40s} {:>32s} {:>9s}'.format(f, h, s))
+
+
+
+if __name__ == "__main__":
+ sys.exit(int(main() or 0))