Use the system default version of Python to run Documentation scripts.
They work fine with Python 2.7 and Python 3.5 anyway and some systems do not have a "python2" binary (e.g. macOS). This will fix the Gerrit CI build on Bazel's CI, which is currently failing with: ERROR: /Users/buildkite/builds/buildkite-macpro-7-1/bazel-downstream-projects/gerrit/Documentation/BUILD:94:1: Couldn't build file Documentation/pg-plugin-endpoints.txt.html_htmlonly_expn: error executing shell command: '.html_htmlonly_expn' failed (Exit 127) env: python2: No such file or directory I tested this change like this: # Build with Python 2 to ensure my local setup is fine. bazel build //Documentation/... # Works fine. # Now build with Python 3 instead, to ensure compatibility. sed -i 's/python2/python3/g' Documentation/replace_macros.py \ tools/bzl/license.bzl bazel clean bazel build //Documentation/... # Works fine, too. Thus we can safely change "python2" to "python" and let the scripts run with the system default version. Change-Id: I107b76bc71e9b42101d57f94ab7c54c90e7c74cb
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python
|
||||
# coding=utf-8
|
||||
# Copyright (C) 2013 The Android Open Source Project
|
||||
#
|
||||
|
@@ -25,7 +25,7 @@ def license_map(name, targets = [], opts = [], **kwargs):
|
||||
# post process the XML into our favorite format.
|
||||
native.genrule(
|
||||
name = "gen_license_txt_" + name,
|
||||
cmd = "python2 $(location //tools/bzl:license-map.py) %s %s > $@" % (" ".join(opts), " ".join(xmls)),
|
||||
cmd = "python $(location //tools/bzl:license-map.py) %s %s > $@" % (" ".join(opts), " ".join(xmls)),
|
||||
outs = [ name + ".txt" ],
|
||||
tools = tools,
|
||||
**kwargs
|
||||
|
Reference in New Issue
Block a user