Bazel: Special handling for plugins not under git control

To be compatible with the shell script, ignore "not a git repository
error" and report "unknown" version.

Change-Id: Ifa5dafea63743e6e09958f4283231c3eb7e45afe
This commit is contained in:
David Ostrovsky 2019-11-03 13:26:35 +01:00
parent a7e95e5bc1
commit 4cdd7f7d86

View File

@ -29,8 +29,8 @@ def revision(directory, parent):
print('could not invoke git: %s' % err, file=sys.stderr)
sys.exit(1)
except subprocess.CalledProcessError as err:
print('error using git: %s' % err, file=sys.stderr)
sys.exit(1)
# ignore "not a git repository error" to report unknown version
return None
finally:
os.chdir(parent)
@ -40,5 +40,5 @@ for d in os.listdir(os.path.join(ROOT, 'plugins')):
p = os.path.join('plugins', d)
if os.path.isdir(p):
v = revision(p, ROOT)
if v:
print('STABLE_BUILD_%s_LABEL %s' % (os.path.basename(p).upper(), v))
print('STABLE_BUILD_%s_LABEL %s' % (os.path.basename(p).upper(),
v if v else 'unknown'))