Skip to content

Commit

Permalink
Refactor the checksum generation code
Browse files Browse the repository at this point in the history
  • Loading branch information
dregad committed Oct 10, 2013
1 parent 89f3453 commit 598f176
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions buildrelease.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,24 +205,18 @@ def main():
# Generate checksums
print "Generating checksums..."

tar_md5 = os.popen("md5sum --binary %s.tar.gz" % (release_name)).read()
tar_sha1 = os.popen("sha1sum --binary %s.tar.gz" % (release_name)).read()

zip_md5 = os.popen("md5sum --binary %s.zip" % (release_name)).read()
zip_sha1 = os.popen("sha1sum --binary %s.zip" % (release_name)).read()

f = open("%s.tar.gz.digests" % release_name, 'w')
f.write("%s\n%s\n" % (tar_md5, tar_sha1))
f.close()
for ext in tarball_ext:
tarball = "%s.%s " % (release_name, ext)
print " " + tarball
f = open("%s.digests" % tarball, 'w')

f = open("%s.zip.digests" % release_name, 'w')
f.write("%s\n%s\n" % (zip_md5, zip_sha1))
f.close()
for method in ("md5", "sha1"):
checksum_cmd = "%ssum --binary " % method
checksum = os.popen(checksum_cmd + tarball).read()
f.write("%s\n" % checksum)
print " %s: %s" % (method, checksum.rstrip())

print " " + tar_md5
print " " + tar_sha1
print " " + zip_md5
print " " + zip_sha1
f.close()

# Cleanup
if clean_build:
Expand Down

0 comments on commit 598f176

Please sign in to comment.