Skip to content

Commit

Permalink
Tell the Python build where Bazelisk is.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Paul Wankadia <[email protected]>
  • Loading branch information
junyer committed Jul 28, 2023
1 parent 8ad66d6 commit c20f76e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
shell: bash
- name: Build wheel
run: |
python setup.py bdist_wheel
BAZELISK="$(which bazelisk)" python setup.py bdist_wheel
python -m auditwheel repair --wheel-dir=. dist/*
shell: bash
working-directory: python
Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:
shell: bash
- name: Build wheel
run: |
python setup.py bdist_wheel \
BAZELISK="$(which bazelisk)" python setup.py bdist_wheel \
--plat-name=macosx-${{ matrix.os }}.0-${{ matrix.arch.python-name }}
python -m delocate.cmd.delocate_wheel --wheel-dir=. dist/*
shell: bash
Expand Down Expand Up @@ -128,7 +128,7 @@ jobs:
shell: bash
- name: Build wheel
run: |
python setup.py bdist_wheel \
BAZELISK="$(which bazelisk)" python setup.py bdist_wheel \
--plat-name=${{ matrix.arch.python-name }}
python -m delvewheel --wheel-dir=. dist/*
shell: bash
Expand Down
6 changes: 3 additions & 3 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@
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']
Expand All @@ -62,7 +62,7 @@ def build_extension(self, 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)


Expand Down

0 comments on commit c20f76e

Please sign in to comment.