diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 5444769c3..6f78645b5 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -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 @@ -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 @@ -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 diff --git a/python/setup.py b/python/setup.py index a05c798b8..5e292ac81 100644 --- a/python/setup.py +++ b/python/setup.py @@ -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'] @@ -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)