Tell the Python build where Bazelisk is.

I have no idea what's going on with the
path on GitHub-hosted runners: the `bazelisk`
command works across platforms when called from
`bazel.sh` and also works on macOS when called
from the Python build, but fails on Linux and
Windows when called from the Python build.

Change-Id: I0447cf4a8eef5bd4318d0be7d44c31a357643c19
Reviewed-on: https://code-review.googlesource.com/c/re2/+/61592
Reviewed-by: Perry Lorier <perryl@google.com>
Reviewed-by: Paul Wankadia <junyer@google.com>
This commit is contained in:
Paul Wankadia
2023-07-28 11:57:29 +00:00
parent 8ad66d6df9
commit c20f76ecc5
2 changed files with 6 additions and 6 deletions

View File

@@ -45,13 +45,13 @@ Known issues with regard to building the C++ extension:
class BuildExt(setuptools.command.build_ext.build_ext):
def build_extension(self, ext):
if 'GITHUB_ACTIONS' not in os.environ:
if 'BAZELISK' not in os.environ:
return super().build_extension(ext)
# For @pybind11_bazel's `python_configure()`.
os.environ['PYTHON_BIN_PATH'] = sys.executable
cmd = ['bazelisk', 'build']
cmd = [os.environ['BAZELISK'], 'build']
if 'BAZEL_CPU' in os.environ:
cmd.append(f'--cpu={os.environ["BAZEL_CPU"].lower()}')
cmd += ['--compilation_mode=opt', '--', ':all']
@@ -62,7 +62,7 @@ class BuildExt(setuptools.command.build_ext.build_ext):
shutil.copyfile('../bazel-bin/python/_re2.so',
self.get_ext_fullpath(ext.name))
cmd = ['bazelisk', 'clean', '--expunge']
cmd = [os.environ['BAZELISK'], 'clean', '--expunge']
self.spawn(cmd)