From e1bf1f048e783578bcbdaa4572ce3c93908b6494 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Wed, 5 Jun 2024 13:36:57 -0700 Subject: [PATCH] Update rules_python to 0.28.0 Closes #15849 PiperOrigin-RevId: 640633756 --- .github/workflows/test_bazel.yml | 2 +- .github/workflows/test_cpp.yml | 14 ++++++------ .github/workflows/test_upb.yml | 4 ++-- .readthedocs.yml | 2 +- MODULE.bazel | 2 +- WORKSPACE | 10 ++++++--- protobuf_deps.bzl | 8 +++---- python/dist/system_python.bzl | 12 ++++------ third_party/rules_fuzzing.patch | 38 +++++++++++--------------------- 9 files changed, 40 insertions(+), 52 deletions(-) diff --git a/.github/workflows/test_bazel.yml b/.github/workflows/test_bazel.yml index 3a488a1bb497..0569790b9bac 100644 --- a/.github/workflows/test_bazel.yml +++ b/.github/workflows/test_bazel.yml @@ -17,7 +17,7 @@ jobs: fail-fast: false matrix: runner: [ ubuntu, windows, macos ] - bazelversion: [ '7.1.1' ] + bazelversion: [ '7.1.2' ] bzlmod: [true, false ] include: - runner: ubuntu diff --git a/.github/workflows/test_cpp.yml b/.github/workflows/test_cpp.yml index 8ab24bca8580..ad135a2f648d 100644 --- a/.github/workflows/test_cpp.yml +++ b/.github/workflows/test_cpp.yml @@ -26,19 +26,19 @@ jobs: - { name: No-RTTI, flags: --cxxopt=-fno-rtti } include: # Set defaults - - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/sanitize@sha256:04cd765285bc52cbbf51d66c8c66d8603579cf0f19cc42df26b09d2c270541fb + - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/sanitize@sha256:3d959f731dc5c54af4865c31ee2bd581ec40028adcdf4c038f3122581f595191 - targets: //pkg/... //src/... @com_google_protobuf_examples//... //third_party/utf8_range/... # Override cases with custom images - config: { name: "Bazel7" } - image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.1-75f2a85ece6526cc3d54087018c0f1097d78d42b" + image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-cf84e92285ca133b9c8104ad7b14d70e953cbb8e" targets: "//src/... //third_party/utf8_range/..." - config: { name: "TCMalloc" } - image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/tcmalloc@sha256:bd39119d74b8a3fad4ae335d4cf5294e70384676331b7e19949459fc7a8d8328" + image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/tcmalloc@sha256:1c5133455481f4d1bb8afa477029604f41f1a3c46cebe4d9958cf1af95b5c87c" targets: "//src/... //third_party/utf8_range/..." - config: { name: "aarch64" } targets: "//src/... //src/google/protobuf/compiler:protoc_aarch64_test //third_party/utf8_range/..." - image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:aarch64-63dd26c0c7a808d92673a3e52e848189d4ab0f17" + image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:6.3.0-aarch64-68e662b3a56b881804dc4e9d45f949791cbc4b94" name: Linux ${{ matrix.config.name }} runs-on: ${{ matrix.config.runner || 'ubuntu-latest' }} steps: @@ -102,7 +102,7 @@ jobs: - name: Run tests uses: protocolbuffers/protobuf-ci/docker@v3 with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:${{ matrix.arch }}-63dd26c0c7a808d92673a3e52e848189d4ab0f17 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:${{ matrix.arch }}-384d5abe83a791c6b1ce04f5d7bc0b1f84a30d38 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} entrypoint: bash command: > @@ -328,7 +328,7 @@ jobs: os: macos-12 cache_key: macos-12-bazel7 bazel: test //src/... //third_party/utf8_range/... - bazel_version: '7.1.1' + bazel_version: '7.1.2' - name: MacOS Apple Silicon (build only) Bazel os: macos-12 cache_key: macos-12-arm @@ -343,7 +343,7 @@ jobs: os: windows-2022 cache_key: windows-2022-bazel7 bazel: test //src/... @com_google_protobuf_examples//... --test_tag_filters=-conformance --build_tag_filters=-conformance - bazel_version: '7.1.1' + bazel_version: '7.1.2' name: ${{ matrix.name }} runs-on: ${{ matrix.os }} steps: diff --git a/.github/workflows/test_upb.yml b/.github/workflows/test_upb.yml index e0e0d4d12870..a2ef1cbd4845 100644 --- a/.github/workflows/test_upb.yml +++ b/.github/workflows/test_upb.yml @@ -123,7 +123,7 @@ jobs: - name: Run tests uses: protocolbuffers/protobuf-ci/bazel-docker@v3 with: - image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:6.3.0-91a0ac83e968068672bc6001a4d474cfd9a50f1d + image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:6.3.0-8ae66c8e49db9a3db7ed62424524e63bab7a96e5 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: "upb-bazel-no-python" bash: >- @@ -144,7 +144,7 @@ jobs: - name: Build Wheels uses: protocolbuffers/protobuf-ci/bazel-docker@v3 with: - image: us-docker.pkg.dev/protobuf-build/release-containers/linux/apple@sha256:b3dc9b75d8e599b0e95ed245d89f44b5a4231112f975da89dd02006a484a58df + image: us-docker.pkg.dev/protobuf-build/release-containers/linux/apple:6.3.0-53225851b051e66f8543e972c143f35be757a181 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: upb-bazel-python bazel: build --crosstool_top=//toolchain:clang_suite --//toolchain:release=true --symlink_prefix=/ -c dbg //python/dist //python/dist:test_wheel //python/dist:source_wheel diff --git a/.readthedocs.yml b/.readthedocs.yml index 88f4c100f36a..10e8fbdc6f79 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -16,7 +16,7 @@ conda: environment: python/docs/environment.yml python: - version: 3.7 + version: 3.8 install: - method: setuptools path: python diff --git a/MODULE.bazel b/MODULE.bazel index b91ab829417b..a8c3d780ae7f 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -19,7 +19,7 @@ bazel_dep(name = "rules_cc", version = "0.0.9") bazel_dep(name = "rules_java", version = "5.3.5") bazel_dep(name = "rules_jvm_external", version = "5.1") bazel_dep(name = "rules_pkg", version = "0.7.0") -bazel_dep(name = "rules_python", version = "0.10.2") +bazel_dep(name = "rules_python", version = "0.28.0") bazel_dep(name = "platforms", version = "0.0.8") bazel_dep(name = "zlib", version = "1.2.11") diff --git a/WORKSPACE b/WORKSPACE index ef112bb54878..7bc8edb294dc 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -25,6 +25,10 @@ load("@rules_python//python:repositories.bzl", "py_repositories") py_repositories() +load("@rules_python//python/pip_install:repositories.bzl", "pip_install_dependencies") + +pip_install_dependencies() + # Bazel platform rules. http_archive( name = "platforms", @@ -177,9 +181,9 @@ install_deps() http_archive( name = "rules_fuzzing", - sha256 = "ff52ef4845ab00e95d29c02a9e32e9eff4e0a4c9c8a6bcf8407a2f19eb3f9190", - strip_prefix = "rules_fuzzing-0.4.1", - urls = ["https://github.com/bazelbuild/rules_fuzzing/releases/download/v0.4.1/rules_fuzzing-0.4.1.zip"], + sha256 = "77206c54b71f4dd5335123a6ff2a8ea688eca5378d34b4838114dff71652cf26", + strip_prefix = "rules_fuzzing-0.5.1", + urls = ["https://github.com/bazelbuild/rules_fuzzing/releases/download/v0.5.1/rules_fuzzing-0.5.1.zip"], patches = ["//third_party:rules_fuzzing.patch"], patch_args = ["-p1"], ) diff --git a/protobuf_deps.bzl b/protobuf_deps.bzl index 9fee18a2a6ec..a852e49a447e 100644 --- a/protobuf_deps.bzl +++ b/protobuf_deps.bzl @@ -100,15 +100,15 @@ def protobuf_deps(): if not native.existing_rule("rules_python"): http_archive( name = "rules_python", - sha256 = "9d04041ac92a0985e344235f5d946f71ac543f1b1565f2cdbc9a2aaee8adf55b", - strip_prefix = "rules_python-0.26.0", - url = "https://github.com/bazelbuild/rules_python/releases/download/0.26.0/rules_python-0.26.0.tar.gz", + sha256 = "d70cd72a7a4880f0000a6346253414825c19cdd40a28289bdf67b8e6480edff8", + strip_prefix = "rules_python-0.28.0", + url = "https://github.com/bazelbuild/rules_python/releases/download/0.28.0/rules_python-0.28.0.tar.gz", ) if not native.existing_rule("system_python"): system_python( name = "system_python", - minimum_python_version = "3.7", + minimum_python_version = "3.8", ) if not native.existing_rule("rules_jvm_external"): diff --git a/python/dist/system_python.bzl b/python/dist/system_python.bzl index 29400be223ac..db5b30e0b61b 100644 --- a/python/dist/system_python.bzl +++ b/python/dist/system_python.bzl @@ -36,7 +36,7 @@ pip_parse = pip_install # Alias rules_python's pip.bzl for cases where a system python is found. _alias_pip = """ -load("@rules_python//python:pip.bzl", _pip_install = "pip_install", _pip_parse = "pip_parse") +load("@rules_python//python:pip.bzl", _pip_parse = "pip_parse") def _get_requirements(requirements, requirements_overrides): for version, override in requirements_overrides.items(): @@ -45,18 +45,14 @@ def _get_requirements(requirements, requirements_overrides): break return requirements -def pip_install(requirements, requirements_overrides={{}}, **kwargs): - _pip_install( - python_interpreter_target = "@{repo}//:interpreter", - requirements = _get_requirements(requirements, requirements_overrides), - **kwargs, - ) def pip_parse(requirements, requirements_overrides={{}}, **kwargs): _pip_parse( python_interpreter_target = "@{repo}//:interpreter", - requirements = _get_requirements(requirements, requirements_overrides), + requirements_lock = _get_requirements(requirements, requirements_overrides), **kwargs, ) + +pip_install = pip_parse """ _mock_fuzzing_py = """ diff --git a/third_party/rules_fuzzing.patch b/third_party/rules_fuzzing.patch index 596a44dc768d..5e5965ad8033 100644 --- a/third_party/rules_fuzzing.patch +++ b/third_party/rules_fuzzing.patch @@ -1,25 +1,13 @@ -diff --git a/fuzzing/tools/validate_dict.py b/fuzzing/tools/validate_dict.py -index d561e68..52cbcb8 100644 ---- a/fuzzing/tools/validate_dict.py -+++ b/fuzzing/tools/validate_dict.py -@@ -19,7 +19,7 @@ Validates and merges a set of fuzzing dictionary files into a single output. - - from absl import app - from absl import flags --from dict_validation import validate_line -+from fuzzing.tools.dict_validation import validate_line - from sys import stderr - - FLAGS = flags.FLAGS -diff --git a/fuzzing/requirements.txt b/fuzzing/requirements.txt -index 01482d4..4b36f4f 100644 ---- a/fuzzing/requirements.txt -+++ b/fuzzing/requirements.txt -@@ -1,5 +1,5 @@ - # Python requirements for the tools supporting the fuzzing rules. These are - # installed automatically through the WORKSPACE configuration. - --absl-py==0.11.0 --hash=sha256:b3d9eb5119ff6e0a0125f6dabf2f9fae02f8acae7be70576002fac27235611c5 --six==1.15.0 --hash=sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced -+absl-py==2.0.0 --hash=sha256:9a28abb62774ae4e8edbe2dd4c49ffcd45a6a848952a5eccc6a49f3f0fc1e2f3 -+six==1.16.0 --hash=sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254 +diff --git a/fuzzing/private/binary.bzl b/fuzzing/private/binary.bzl +index 4c85aed..8ff9723 100644 +--- a/fuzzing/private/binary.bzl ++++ b/fuzzing/private/binary.bzl +@@ -114,7 +114,7 @@ def _fuzzing_binary_impl(ctx): + else: + default_info = ctx.attr.binary[DefaultInfo] + binary_runfiles = default_info.default_runfiles +- binary_repo_mapping_manifest = getattr(default_info.files_to_run, "repo_mapping_manifest") ++ binary_repo_mapping_manifest = getattr(default_info.files_to_run, "repo_mapping_manifest", None) + other_runfiles = [] + if ctx.file.corpus: + other_runfiles.append(ctx.file.corpus) \ No newline at end of file