Create a dir for scripts

This commit is contained in:
2016-07-26 21:59:43 +02:00
parent 8c73487c08
commit 3d68c57224
+22
View File
@@ -0,0 +1,22 @@
#!/usr/bin/python
import re
import subprocess
def main():
source = open(".gitmodules").read()
paths = re.findall(r"path = (.*)", source)
print("github.com/localhots/shezmu {}".format(path_sha1(".")))
for path in paths:
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].decode("ascii")
return sha1
if __name__ == "__main__":
main()