aedi: fetch from remote repo if source directory exists

This commit is contained in:
alexey.lysiuk 2021-02-18 13:26:56 +02:00
parent ac324a8b06
commit 405d1a3b1f

View file

@ -69,9 +69,12 @@ class BuildState:
return self.platform.cxx_compiler if self.platform else ''
def checkout_git(self, url: str, branch: str = 'master'):
if not os.path.exists(self.source):
if os.path.exists(self.source):
args = ('git', 'fetch', '--all', '--tags')
subprocess.run(args, cwd=self.source, check=True)
else:
args = ('git', 'clone', '--recurse-submodules', url, self.source)
subprocess.check_call(args, cwd=self.root_path)
subprocess.run(args, cwd=self.root_path, check=True)
if self.checkout_commit:
checkout_args = (self.checkout_commit,)