Bump upb version and refactor python compatibility.
This pulls in updates to system_python, which allows for better handling of our non-hermetic setup. Specifically, our python tests are marked incompatible on systems without a python installation. This will cause them to get skipped by wildcard expansions (which is why we add 1 explicit target to the kokoro builds).
PiperOrigin-RevId: 492286518
diff --git a/python/BUILD.bazel b/python/BUILD.bazel
index 56d8c8a..d40e76a 100644
--- a/python/BUILD.bazel
+++ b/python/BUILD.bazel
@@ -12,7 +12,7 @@
load("//:protobuf.bzl", "internal_py_proto_library")
load("//build_defs:cpp_opts.bzl", "COPTS")
load("//conformance:defs.bzl", "conformance_test")
-load(":internal.bzl", "internal_copy_files")
+load(":internal.bzl", "internal_copy_files", "internal_py_test")
py_library(
name = "protobuf_python",
@@ -256,149 +256,111 @@
],
)
-py_test(
+internal_py_test(
name = "descriptor_database_test",
srcs = ["google/protobuf/internal/descriptor_database_test.py"],
- deps = [":python_test_lib"],
)
-py_test(
+internal_py_test(
name = "descriptor_pool_test",
srcs = ["google/protobuf/internal/descriptor_pool_test.py"],
- deps = [":python_test_lib"],
)
-py_test(
+internal_py_test(
name = "descriptor_test",
srcs = ["google/protobuf/internal/descriptor_test.py"],
- imports = ["."],
- deps = [":python_test_lib"],
)
-py_test(
+internal_py_test(
name = "field_mask_test",
srcs = ["google/protobuf/internal/field_mask_test.py"],
- imports = ["."],
- deps = [":python_test_lib"],
)
-py_test(
+internal_py_test(
name = "generator_test",
srcs = ["google/protobuf/internal/generator_test.py"],
- imports = ["."],
- deps = [":python_test_lib"],
)
-py_test(
+internal_py_test(
name = "import_test",
srcs = ["google/protobuf/internal/import_test.py"],
- imports = ["."],
- deps = [":python_test_lib"],
)
-py_test(
+internal_py_test(
name = "json_format_test",
srcs = ["google/protobuf/internal/json_format_test.py"],
- imports = ["."],
- deps = [":python_test_lib"],
)
-py_test(
+internal_py_test(
name = "keywords_test",
srcs = ["google/protobuf/internal/keywords_test.py"],
- imports = ["."],
- deps = [":python_test_lib"],
)
-py_test(
+internal_py_test(
name = "message_factory_test",
srcs = ["google/protobuf/internal/message_factory_test.py"],
- imports = ["."],
- deps = [":python_test_lib"],
)
-py_test(
+internal_py_test(
name = "message_test",
srcs = ["google/protobuf/internal/message_test.py"],
data = glob(["testdata/golden_pickle_*"]) + [
"//src/google/protobuf:testdata",
],
- imports = ["."],
- deps = [":python_test_lib"],
)
-py_test(
+internal_py_test(
name = "numpy_test",
srcs = ["google/protobuf/internal/numpy_test.py"],
- imports = ["."],
deps = [
- ":python_test_lib",
requirement("numpy"),
],
)
-py_test(
+internal_py_test(
name = "proto_builder_test",
srcs = ["google/protobuf/internal/proto_builder_test.py"],
- imports = ["."],
- deps = [":python_test_lib"],
)
-py_test(
+internal_py_test(
name = "reflection_test",
srcs = ["google/protobuf/internal/reflection_test.py"],
- imports = ["."],
- deps = [":python_test_lib"],
)
-py_test(
+internal_py_test(
name = "service_reflection_test",
srcs = ["google/protobuf/internal/service_reflection_test.py"],
- imports = ["."],
- deps = [":python_test_lib"],
)
-py_test(
+internal_py_test(
name = "symbol_database_test",
srcs = ["google/protobuf/internal/symbol_database_test.py"],
- imports = ["."],
- deps = [":python_test_lib"],
)
-py_test(
+internal_py_test(
name = "text_encoding_test",
srcs = ["google/protobuf/internal/text_encoding_test.py"],
- imports = ["."],
- deps = [":python_test_lib"],
)
-py_test(
+internal_py_test(
name = "text_format_test",
srcs = ["google/protobuf/internal/text_format_test.py"],
data = ["//src/google/protobuf:testdata"],
- imports = ["."],
- deps = [":python_test_lib"],
)
-py_test(
+internal_py_test(
name = "unknown_fields_test",
srcs = ["google/protobuf/internal/unknown_fields_test.py"],
- imports = ["."],
- deps = [":python_test_lib"],
)
-py_test(
+internal_py_test(
name = "well_known_types_test",
srcs = ["google/protobuf/internal/well_known_types_test.py"],
- imports = ["."],
- deps = [":python_test_lib"],
)
-py_test(
+internal_py_test(
name = "wire_format_test",
srcs = ["google/protobuf/internal/wire_format_test.py"],
- imports = ["."],
- deps = [":python_test_lib"],
)
cc_library(
@@ -410,7 +372,7 @@
],
)
-py_test(
+internal_py_test(
name = "python_version",
srcs = ["python_version.py"],
)
@@ -420,6 +382,7 @@
env = {"PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": "python"},
failure_list = "//conformance:failure_list_python.txt",
target_compatible_with = select({
+ "@system_python//:none": ["@platforms//:incompatible"],
":use_fast_cpp_protos": ["@platforms//:incompatible"],
"//conditions:default": [],
}),
@@ -433,6 +396,7 @@
env = {"PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": "cpp"},
failure_list = "//conformance:failure_list_python.txt",
target_compatible_with = select({
+ "@system_python//:none": ["@platforms//:incompatible"],
":use_fast_cpp_protos": [],
"//conditions:default": ["@platforms//:incompatible"],
}),