]> git.parisson.com Git - mezzo.git/commitdiff
auto detect repo root
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Thu, 21 Jan 2016 08:50:39 +0000 (09:50 +0100)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Thu, 21 Jan 2016 08:50:39 +0000 (09:50 +0100)
app/deploy/install_linux_sysvinit.py

index da6a0885f4cc714da857a401389bcf40e517d07c..526a67c24dfb4c4d7986a4214cac9f15cbd3ca31 100755 (executable)
@@ -2,6 +2,19 @@
 
 import os
 
+path = os.getcwd()
+vcss = ['git', 'svn', 'hg']
+
+def is_repo_root(path):
+    content = os.listdir(path)
+    for vcs in vcss:
+        if '.' + vcs in content:
+            return True
+    return False
+
+while not is_repo_root(path):
+    path = os.sep.join(path.split(os.sep)[:-1])
+
 path = os.sep.join(os.getcwd().split(os.sep)[:-2])
 name = path.split(os.sep)[-1].lower()
 conf = path + os.sep + 'docker-compose.yml'