From: Guillaume Pellerin Date: Thu, 21 Jan 2016 08:50:39 +0000 (+0100) Subject: auto detect repo root X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=f8697fc66079d13e6bff46d300c287afeac9b5da;p=mezzo.git auto detect repo root --- diff --git a/app/deploy/install_linux_sysvinit.py b/app/deploy/install_linux_sysvinit.py index da6a0885..526a67c2 100755 --- a/app/deploy/install_linux_sysvinit.py +++ b/app/deploy/install_linux_sysvinit.py @@ -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'