mirror of
https://github.com/ZDoom/zdoom-macos-deps.git
synced 2025-01-31 20:10:32 +00:00
aedi: ability to checkout non-default branch
This commit is contained in:
parent
38a0a398e1
commit
982fe6b371
1 changed files with 13 additions and 3 deletions
|
@ -68,14 +68,24 @@ class BuildState:
|
|||
def cxx_compiler(self) -> str:
|
||||
return self.platform.cxx_compiler if self.platform else ''
|
||||
|
||||
def checkout_git(self, url: str):
|
||||
def checkout_git(self, url: str, branch: str = 'master'):
|
||||
if not os.path.exists(self.source):
|
||||
args = ('git', 'clone', '--recurse-submodules', url, self.source)
|
||||
subprocess.check_call(args, cwd=self.root_path)
|
||||
|
||||
if self.checkout_commit:
|
||||
args = ['git', 'checkout', self.checkout_commit]
|
||||
subprocess.check_call(args, cwd=self.source)
|
||||
checkout_args = (self.checkout_commit,)
|
||||
else:
|
||||
args = ('git', 'show-ref', '--quiet', 'refs/heads/' + branch)
|
||||
branch_exists = 0 == subprocess.run(args, cwd=self.source).returncode
|
||||
|
||||
if branch_exists:
|
||||
checkout_args = (branch,)
|
||||
else:
|
||||
checkout_args = ('-b', branch, 'origin/' + branch)
|
||||
|
||||
args = ('git', 'checkout') + checkout_args
|
||||
subprocess.run(args, cwd=self.source, check=True)
|
||||
|
||||
def download_source(self, url: str, checksum: str):
|
||||
if self.external_source:
|
||||
|
|
Loading…
Reference in a new issue