2016-01-10 20:30:02 +03:00
|
|
|
#!/usr/bin/python
|
|
|
|
|
|
|
|
import re
|
|
|
|
import subprocess
|
|
|
|
|
|
|
|
def main():
|
|
|
|
source = open(".gitmodules").read()
|
|
|
|
paths = re.findall(r"path = (.*)", source)
|
|
|
|
|
2016-01-24 19:49:57 +03:00
|
|
|
print("github.com/localhots/shezmu {}".format(path_sha1(".")))
|
2016-01-10 20:30:02 +03:00
|
|
|
for path in paths:
|
2016-01-10 22:30:45 +03:00
|
|
|
print("{} {}".format(path[7:], path_sha1(path)))
|
2016-01-10 20:30:02 +03:00
|
|
|
|
|
|
|
def path_sha1(path):
|
|
|
|
cmd = "cd {} && git rev-parse HEAD".format(path)
|
|
|
|
sp = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
|
2016-01-10 22:30:45 +03:00
|
|
|
sha1 = sp.stdout.read()[:-1].decode("ascii")
|
2016-01-10 20:30:02 +03:00
|
|
|
|
|
|
|
return sha1
|
|
|
|
|
2016-01-10 22:30:45 +03:00
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|