Created
June 14, 2012 17:36
-
-
Save lolsborn/2931656 to your computer and use it in GitHub Desktop.
sha1 manifest in json for [redacted]
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
#!/usr/bin/env python | |
import hashlib | |
import json | |
import glob | |
import sys | |
import os | |
pass_path = "%s/*" % sys.argv[1] | |
manifest = {} | |
for file_path in glob.glob(pass_path): | |
if os.path.isfile(file_path): | |
file_name = file_path[len(sys.argv[1]) + 1:] | |
if file_path.endswith("manifest.json"): | |
continue | |
manifest[file_name] = hashlib.sha1(open(file_path, "rb").read()).hexdigest() | |
else: | |
print "not file", file_path | |
manifest_file = open("%s/manifest.json" % sys.argv[1], "w") | |
manifest_file.write(json.dumps(manifest, sort_keys=True, indent=4)) |
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
#!/usr/bin/env python | |
import hashlib | |
import json | |
import glob | |
import sys | |
import os | |
pass_path = "%s/*" % sys.argv[1] | |
manifest = {} | |
for file_path in glob.glob(pass_path): | |
if os.path.isfile(file_path): | |
file_name = file_path[len(sys.argv[1]) + 1:] | |
if file_path.endswith("manifest.json"): | |
continue | |
manifest[file_name] = hashlib.sha1(open(file_path, "rb").read()).hexdigest() | |
else: | |
print "not file", file_path | |
manifest_file = open("%s/manifest.json" % sys.argv[1], "w") | |
manifest_file.write(json.dumps(manifest, sort_keys=True, indent=4)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment