From 154c493b64cf227c366e63dc8346d76601d36ba6 Mon Sep 17 00:00:00 2001 From: Gregory Eremin Date: Sun, 10 Jan 2016 22:30:45 +0300 Subject: [PATCH] Make submodules script work in both 2 and 3 pythons --- submodules-to-glockfile.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/submodules-to-glockfile.py b/submodules-to-glockfile.py index 236895e..c507afb 100755 --- a/submodules-to-glockfile.py +++ b/submodules-to-glockfile.py @@ -7,18 +7,16 @@ def main(): source = open(".gitmodules").read() paths = re.findall(r"path = (.*)", source) - print "github.com/localhots/satan {}".format(path_sha1(".")) + print("github.com/localhots/satan {}".format(path_sha1("."))) for path in paths: - print "{repo} {sha}".format( - repo = path[7:], - sha = path_sha1(path) - ) + print("{} {}".format(path[7:], path_sha1(path))) def path_sha1(path): cmd = "cd {} && git rev-parse HEAD".format(path) sp = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE) - sha1 = sp.stdout.read()[:-1] + sha1 = sp.stdout.read()[:-1].decode("ascii") return sha1 -if __name__ == "__main__": main() +if __name__ == "__main__": + main()