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
diff --git a/tools/workspace_status.py b/tools/workspace_status.py
index eef864e..86df519 100644
--- a/tools/workspace_status.py
+++ b/tools/workspace_status.py
@@ -29,8 +29,8 @@
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 @@
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'))