mirror of
https://github.com/google/re2.git
synced 2025-10-19 02:17:46 +08:00
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:
6
.github/workflows/python.yml
vendored
6
.github/workflows/python.yml
vendored
@@ -36,7 +36,7 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
- name: Build wheel
|
- name: Build wheel
|
||||||
run: |
|
run: |
|
||||||
python setup.py bdist_wheel
|
BAZELISK="$(which bazelisk)" python setup.py bdist_wheel
|
||||||
python -m auditwheel repair --wheel-dir=. dist/*
|
python -m auditwheel repair --wheel-dir=. dist/*
|
||||||
shell: bash
|
shell: bash
|
||||||
working-directory: python
|
working-directory: python
|
||||||
@@ -81,7 +81,7 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
- name: Build wheel
|
- name: Build wheel
|
||||||
run: |
|
run: |
|
||||||
python setup.py bdist_wheel \
|
BAZELISK="$(which bazelisk)" python setup.py bdist_wheel \
|
||||||
--plat-name=macosx-${{ matrix.os }}.0-${{ matrix.arch.python-name }}
|
--plat-name=macosx-${{ matrix.os }}.0-${{ matrix.arch.python-name }}
|
||||||
python -m delocate.cmd.delocate_wheel --wheel-dir=. dist/*
|
python -m delocate.cmd.delocate_wheel --wheel-dir=. dist/*
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -128,7 +128,7 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
- name: Build wheel
|
- name: Build wheel
|
||||||
run: |
|
run: |
|
||||||
python setup.py bdist_wheel \
|
BAZELISK="$(which bazelisk)" python setup.py bdist_wheel \
|
||||||
--plat-name=${{ matrix.arch.python-name }}
|
--plat-name=${{ matrix.arch.python-name }}
|
||||||
python -m delvewheel --wheel-dir=. dist/*
|
python -m delvewheel --wheel-dir=. dist/*
|
||||||
shell: bash
|
shell: bash
|
||||||
|
@@ -45,13 +45,13 @@ Known issues with regard to building the C++ extension:
|
|||||||
class BuildExt(setuptools.command.build_ext.build_ext):
|
class BuildExt(setuptools.command.build_ext.build_ext):
|
||||||
|
|
||||||
def build_extension(self, ext):
|
def build_extension(self, ext):
|
||||||
if 'GITHUB_ACTIONS' not in os.environ:
|
if 'BAZELISK' not in os.environ:
|
||||||
return super().build_extension(ext)
|
return super().build_extension(ext)
|
||||||
|
|
||||||
# For @pybind11_bazel's `python_configure()`.
|
# For @pybind11_bazel's `python_configure()`.
|
||||||
os.environ['PYTHON_BIN_PATH'] = sys.executable
|
os.environ['PYTHON_BIN_PATH'] = sys.executable
|
||||||
|
|
||||||
cmd = ['bazelisk', 'build']
|
cmd = [os.environ['BAZELISK'], 'build']
|
||||||
if 'BAZEL_CPU' in os.environ:
|
if 'BAZEL_CPU' in os.environ:
|
||||||
cmd.append(f'--cpu={os.environ["BAZEL_CPU"].lower()}')
|
cmd.append(f'--cpu={os.environ["BAZEL_CPU"].lower()}')
|
||||||
cmd += ['--compilation_mode=opt', '--', ':all']
|
cmd += ['--compilation_mode=opt', '--', ':all']
|
||||||
@@ -62,7 +62,7 @@ class BuildExt(setuptools.command.build_ext.build_ext):
|
|||||||
shutil.copyfile('../bazel-bin/python/_re2.so',
|
shutil.copyfile('../bazel-bin/python/_re2.so',
|
||||||
self.get_ext_fullpath(ext.name))
|
self.get_ext_fullpath(ext.name))
|
||||||
|
|
||||||
cmd = ['bazelisk', 'clean', '--expunge']
|
cmd = [os.environ['BAZELISK'], 'clean', '--expunge']
|
||||||
self.spawn(cmd)
|
self.spawn(cmd)
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user