mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 23:14:34 +02:00
Fix prebuild crash if can't find git binary (such as when running under Android Studio)
This commit is contained in:
parent
51884155ee
commit
f896623404
1 changed files with 4 additions and 1 deletions
|
@ -58,6 +58,9 @@ logging.setLoggerClass(TrackableLogger)
|
||||||
logger = logging.getLogger('prebuild')
|
logger = logging.getLogger('prebuild')
|
||||||
|
|
||||||
def headSha():
|
def headSha():
|
||||||
|
if shutil.which('git') is None:
|
||||||
|
logger.warn("Unable to find git executable, can't caclulate commit ID")
|
||||||
|
return '0xDEADBEEF'
|
||||||
repo_dir = os.path.dirname(os.path.abspath(__file__))
|
repo_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
git = subprocess.Popen(
|
git = subprocess.Popen(
|
||||||
'git rev-parse --short HEAD',
|
'git rev-parse --short HEAD',
|
||||||
|
@ -67,7 +70,7 @@ def headSha():
|
||||||
stdout, _ = git.communicate()
|
stdout, _ = git.communicate()
|
||||||
sha = stdout.split('\n')[0]
|
sha = stdout.split('\n')[0]
|
||||||
if not sha:
|
if not sha:
|
||||||
raise RuntimeError("couldn't find git sha")
|
raise RuntimeError("couldn't find git sha for repository {}".format(repo_dir))
|
||||||
return sha
|
return sha
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
|
|
Loading…
Reference in a new issue