2022-04-13 09:06:17 -07:00
|
|
|
# Copyright (c) 2009-2022, Google LLC
|
|
|
|
|
# All rights reserved.
|
|
|
|
|
#
|
2023-09-08 17:13:32 -07:00
|
|
|
# Use of this source code is governed by a BSD-style
|
|
|
|
|
# license that can be found in the LICENSE file or at
|
|
|
|
|
# https://developers.google.com/open-source/licenses/bsd
|
2022-04-13 09:06:17 -07:00
|
|
|
|
2024-04-03 01:34:28 -07:00
|
|
|
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
|
2024-03-26 18:50:37 -07:00
|
|
|
load("@bazel_skylib//lib:selects.bzl", "selects")
|
2025-01-14 10:28:32 -08:00
|
|
|
load("@protobuf_pip_deps//:requirements.bzl", "requirement")
|
2024-02-13 09:06:30 -08:00
|
|
|
load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix")
|
|
|
|
|
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
|
2022-04-13 09:06:17 -07:00
|
|
|
load("@rules_python//python:packaging.bzl", "py_wheel")
|
2025-08-19 19:27:41 -07:00
|
|
|
load("@rules_shell//shell:sh_binary.bzl", "sh_binary")
|
2022-05-03 16:50:23 -07:00
|
|
|
load("@system_python//:version.bzl", "SYSTEM_PYTHON_VERSION")
|
2023-09-20 16:52:54 -07:00
|
|
|
load("//:protobuf_version.bzl", "PROTOBUF_PYTHON_VERSION")
|
|
|
|
|
load(":dist.bzl", "py_dist", "py_dist_module")
|
2024-04-03 01:34:28 -07:00
|
|
|
load(":py_proto_library.bzl", "py_proto_library")
|
2022-04-13 09:06:17 -07:00
|
|
|
|
|
|
|
|
licenses(["notice"])
|
|
|
|
|
|
|
|
|
|
py_dist_module(
|
|
|
|
|
name = "message_mod",
|
2023-09-26 14:36:20 -07:00
|
|
|
extension = "//python:_message_binary",
|
2022-04-26 16:34:34 -07:00
|
|
|
module_name = "google._upb._message",
|
2022-04-13 09:06:17 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
py_proto_library(
|
|
|
|
|
name = "well_known_proto_py_pb2",
|
|
|
|
|
deps = [
|
2023-09-12 13:06:39 -07:00
|
|
|
"//:any_proto",
|
|
|
|
|
"//:api_proto",
|
|
|
|
|
"//:descriptor_proto",
|
|
|
|
|
"//:duration_proto",
|
|
|
|
|
"//:empty_proto",
|
|
|
|
|
"//:field_mask_proto",
|
|
|
|
|
"//:source_context_proto",
|
|
|
|
|
"//:struct_proto",
|
|
|
|
|
"//:timestamp_proto",
|
|
|
|
|
"//:type_proto",
|
|
|
|
|
"//:wrappers_proto",
|
2022-04-13 09:06:17 -07:00
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2022-12-20 00:04:21 +00:00
|
|
|
py_proto_library(
|
2023-01-13 13:41:03 -08:00
|
|
|
name = "plugin_py_pb2",
|
2023-09-12 13:06:39 -07:00
|
|
|
deps = ["//:compiler_plugin_proto"],
|
2022-12-20 00:04:21 +00:00
|
|
|
)
|
|
|
|
|
|
2022-04-13 09:06:17 -07:00
|
|
|
config_setting(
|
2022-10-14 12:29:23 -07:00
|
|
|
name = "linux_aarch64_release",
|
2023-08-02 12:40:19 -07:00
|
|
|
flag_values = {
|
2023-09-12 13:06:39 -07:00
|
|
|
"//toolchain:release": "True",
|
2023-08-02 12:40:19 -07:00
|
|
|
},
|
2022-04-13 09:06:17 -07:00
|
|
|
values = {"cpu": "linux-aarch_64"},
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
config_setting(
|
2022-10-14 12:29:23 -07:00
|
|
|
name = "linux_aarch64_local",
|
|
|
|
|
constraint_values = [
|
2022-10-25 15:40:24 -07:00
|
|
|
"@platforms//os:linux",
|
|
|
|
|
"@platforms//cpu:aarch64",
|
2022-10-14 12:29:23 -07:00
|
|
|
],
|
2023-08-02 12:40:19 -07:00
|
|
|
flag_values = {
|
2023-09-12 13:06:39 -07:00
|
|
|
"//toolchain:release": "False",
|
2023-08-02 12:40:19 -07:00
|
|
|
},
|
2022-10-14 12:29:23 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
config_setting(
|
|
|
|
|
name = "linux_x86_64_release",
|
2023-08-02 12:40:19 -07:00
|
|
|
flag_values = {
|
2023-09-12 13:06:39 -07:00
|
|
|
"//toolchain:release": "True",
|
2023-08-02 12:40:19 -07:00
|
|
|
},
|
2022-04-13 09:06:17 -07:00
|
|
|
values = {"cpu": "linux-x86_64"},
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
config_setting(
|
2022-10-14 12:29:23 -07:00
|
|
|
name = "linux_x86_64_local",
|
|
|
|
|
constraint_values = [
|
2022-10-25 15:40:24 -07:00
|
|
|
"@platforms//os:linux",
|
|
|
|
|
"@platforms//cpu:x86_64",
|
2022-10-14 12:29:23 -07:00
|
|
|
],
|
2023-08-02 12:40:19 -07:00
|
|
|
flag_values = {
|
2023-09-12 13:06:39 -07:00
|
|
|
"//toolchain:release": "False",
|
2023-08-02 12:40:19 -07:00
|
|
|
},
|
2022-10-14 12:29:23 -07:00
|
|
|
)
|
|
|
|
|
|
2024-11-22 10:09:31 -08:00
|
|
|
config_setting(
|
2025-09-17 15:46:43 -07:00
|
|
|
name = "linux_s390x_release",
|
2024-11-22 10:09:31 -08:00
|
|
|
flag_values = {
|
|
|
|
|
"//toolchain:release": "True",
|
|
|
|
|
},
|
2025-09-17 15:46:43 -07:00
|
|
|
values = {"cpu": "linux-s390_64"},
|
2024-11-22 10:09:31 -08:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
config_setting(
|
2025-09-17 15:46:43 -07:00
|
|
|
name = "linux_s390x_local",
|
2024-11-22 10:09:31 -08:00
|
|
|
constraint_values = [
|
|
|
|
|
"@platforms//os:linux",
|
|
|
|
|
"@platforms//cpu:s390x",
|
|
|
|
|
],
|
|
|
|
|
flag_values = {
|
|
|
|
|
"//toolchain:release": "False",
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
|
2022-10-14 12:29:23 -07:00
|
|
|
config_setting(
|
|
|
|
|
name = "osx_x86_64_release",
|
2023-08-02 12:40:19 -07:00
|
|
|
flag_values = {
|
2023-09-12 13:06:39 -07:00
|
|
|
"//toolchain:release": "True",
|
2023-08-02 12:40:19 -07:00
|
|
|
},
|
2022-04-13 09:06:17 -07:00
|
|
|
values = {"cpu": "osx-x86_64"},
|
|
|
|
|
)
|
|
|
|
|
|
2022-05-04 16:04:13 -07:00
|
|
|
config_setting(
|
2022-10-14 12:29:23 -07:00
|
|
|
name = "osx_x86_64_local",
|
|
|
|
|
constraint_values = [
|
2022-10-25 15:40:24 -07:00
|
|
|
"@platforms//os:osx",
|
|
|
|
|
"@platforms//cpu:x86_64",
|
2022-10-14 12:29:23 -07:00
|
|
|
],
|
2023-08-02 12:40:19 -07:00
|
|
|
flag_values = {
|
2023-09-12 13:06:39 -07:00
|
|
|
"//toolchain:release": "False",
|
2023-08-02 12:40:19 -07:00
|
|
|
},
|
2022-10-14 12:29:23 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
selects.config_setting_group(
|
|
|
|
|
name = "osx_x86_64",
|
|
|
|
|
match_any = [
|
|
|
|
|
":osx_x86_64_release",
|
|
|
|
|
":osx_x86_64_local",
|
|
|
|
|
],
|
2025-07-23 14:47:52 -07:00
|
|
|
visibility = ["//python:__subpackages__"],
|
2022-10-14 12:29:23 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
config_setting(
|
|
|
|
|
name = "osx_aarch64_release",
|
2023-08-02 12:40:19 -07:00
|
|
|
flag_values = {
|
2023-09-12 13:06:39 -07:00
|
|
|
"//toolchain:release": "True",
|
2023-08-02 12:40:19 -07:00
|
|
|
},
|
2022-05-04 16:04:13 -07:00
|
|
|
values = {"cpu": "osx-aarch_64"},
|
|
|
|
|
)
|
|
|
|
|
|
2022-05-09 09:16:35 -07:00
|
|
|
config_setting(
|
2022-10-14 12:29:23 -07:00
|
|
|
name = "osx_aarch64_local",
|
|
|
|
|
constraint_values = [
|
2022-10-25 15:40:24 -07:00
|
|
|
"@platforms//os:osx",
|
|
|
|
|
"@platforms//cpu:aarch64",
|
2022-10-14 12:29:23 -07:00
|
|
|
],
|
2023-08-02 12:40:19 -07:00
|
|
|
flag_values = {
|
2023-09-12 13:06:39 -07:00
|
|
|
"//toolchain:release": "False",
|
2023-08-02 12:40:19 -07:00
|
|
|
},
|
2022-10-14 12:29:23 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
selects.config_setting_group(
|
|
|
|
|
name = "osx_aarch64",
|
|
|
|
|
match_any = [
|
|
|
|
|
":osx_aarch64_release",
|
|
|
|
|
":osx_aarch64_local",
|
|
|
|
|
],
|
2025-07-23 14:47:52 -07:00
|
|
|
visibility = ["//python:__subpackages__"],
|
2022-10-14 12:29:23 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
config_setting(
|
|
|
|
|
name = "osx_universal2",
|
2022-05-09 09:16:35 -07:00
|
|
|
values = {"cpu": "osx-universal2"},
|
|
|
|
|
)
|
|
|
|
|
|
2022-04-13 09:06:17 -07:00
|
|
|
config_setting(
|
2022-10-14 12:29:23 -07:00
|
|
|
name = "windows_x86_32_release",
|
2023-08-02 12:40:19 -07:00
|
|
|
flag_values = {
|
2023-09-12 13:06:39 -07:00
|
|
|
"//toolchain:release": "True",
|
2023-08-02 12:40:19 -07:00
|
|
|
},
|
2022-04-13 09:06:17 -07:00
|
|
|
values = {"cpu": "win32"},
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
config_setting(
|
2022-10-14 12:29:23 -07:00
|
|
|
name = "windows_x86_32_local",
|
|
|
|
|
constraint_values = [
|
2022-10-25 15:40:24 -07:00
|
|
|
"@platforms//os:windows",
|
|
|
|
|
"@platforms//cpu:x86_32",
|
2022-10-14 12:29:23 -07:00
|
|
|
],
|
2023-08-02 12:40:19 -07:00
|
|
|
flag_values = {
|
2023-09-12 13:06:39 -07:00
|
|
|
"//toolchain:release": "False",
|
2023-08-02 12:40:19 -07:00
|
|
|
},
|
2022-10-14 12:29:23 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
selects.config_setting_group(
|
|
|
|
|
name = "windows_x86_32",
|
|
|
|
|
match_any = [
|
|
|
|
|
":windows_x86_32_release",
|
|
|
|
|
":windows_x86_32_local",
|
|
|
|
|
],
|
2025-07-23 14:47:52 -07:00
|
|
|
visibility = ["//python:__subpackages__"],
|
2022-10-14 12:29:23 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
config_setting(
|
|
|
|
|
name = "windows_x86_64_release",
|
2023-08-02 12:40:19 -07:00
|
|
|
flag_values = {
|
2023-09-12 13:06:39 -07:00
|
|
|
"//toolchain:release": "True",
|
2023-08-02 12:40:19 -07:00
|
|
|
},
|
2022-04-13 09:06:17 -07:00
|
|
|
values = {"cpu": "win64"},
|
|
|
|
|
)
|
|
|
|
|
|
2022-10-14 12:29:23 -07:00
|
|
|
config_setting(
|
|
|
|
|
name = "windows_x86_64_local",
|
|
|
|
|
constraint_values = [
|
2022-10-25 15:40:24 -07:00
|
|
|
"@platforms//os:windows",
|
|
|
|
|
"@platforms//cpu:x86_64",
|
2022-10-14 12:29:23 -07:00
|
|
|
],
|
2023-08-02 12:40:19 -07:00
|
|
|
flag_values = {
|
2023-09-12 13:06:39 -07:00
|
|
|
"//toolchain:release": "False",
|
2023-08-02 12:40:19 -07:00
|
|
|
},
|
2022-10-14 12:29:23 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
selects.config_setting_group(
|
|
|
|
|
name = "windows_x86_64",
|
|
|
|
|
match_any = [
|
|
|
|
|
":windows_x86_64_release",
|
|
|
|
|
":windows_x86_64_local",
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2022-12-20 00:04:21 +00:00
|
|
|
pkg_files(
|
|
|
|
|
name = "generated_wkt",
|
|
|
|
|
srcs = [
|
|
|
|
|
":well_known_proto_py_pb2",
|
2024-08-21 13:24:51 -07:00
|
|
|
"//src/google/protobuf:descriptor_upb_c_proto",
|
|
|
|
|
"//src/google/protobuf:descriptor_upb_minitable_proto",
|
|
|
|
|
"//src/google/protobuf:descriptor_upb_reflection_proto",
|
|
|
|
|
"//upb/reflection:descriptor_upb_proto",
|
2022-12-20 00:04:21 +00:00
|
|
|
],
|
|
|
|
|
prefix = "google/protobuf",
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
pkg_files(
|
|
|
|
|
name = "generated_wkt_compiler",
|
|
|
|
|
srcs = [
|
2023-01-13 13:41:03 -08:00
|
|
|
":plugin_py_pb2",
|
2022-12-20 00:04:21 +00:00
|
|
|
],
|
|
|
|
|
prefix = "google/protobuf/compiler",
|
|
|
|
|
)
|
|
|
|
|
|
2022-12-31 02:37:52 +00:00
|
|
|
pkg_files(
|
|
|
|
|
name = "utf8_range_source_files",
|
2023-11-08 15:36:33 -08:00
|
|
|
srcs = ["//third_party/utf8_range:utf8_range_srcs"],
|
2022-12-31 02:37:52 +00:00
|
|
|
prefix = "utf8_range",
|
|
|
|
|
)
|
|
|
|
|
|
2023-08-04 08:55:54 -07:00
|
|
|
pkg_files(
|
|
|
|
|
name = "dist_source_files",
|
2022-12-20 00:04:21 +00:00
|
|
|
srcs = [
|
2023-02-02 09:10:18 -08:00
|
|
|
"MANIFEST.in",
|
2023-01-13 13:41:03 -08:00
|
|
|
"setup.py",
|
2023-08-04 08:55:54 -07:00
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Passing filegroups to pkg_tar directly results in incorrect
|
|
|
|
|
# `protobuf/external/upb/` directory structure when built from the protobuf
|
|
|
|
|
# repo. This can be removed once repositories are merged.
|
|
|
|
|
pkg_files(
|
|
|
|
|
name = "filegroup_source_files",
|
|
|
|
|
srcs = [
|
2023-09-20 16:52:54 -07:00
|
|
|
"//:LICENSE",
|
2023-09-26 14:36:20 -07:00
|
|
|
"//python:message_srcs",
|
2023-09-12 13:06:39 -07:00
|
|
|
"//upb:source_files",
|
2023-09-26 14:36:20 -07:00
|
|
|
"//upb/base:source_files",
|
|
|
|
|
"//upb/hash:source_files",
|
|
|
|
|
"//upb/lex:source_files",
|
|
|
|
|
"//upb/mem:source_files",
|
|
|
|
|
"//upb/message:source_files",
|
|
|
|
|
"//upb/mini_descriptor:source_files",
|
|
|
|
|
"//upb/mini_table:source_files",
|
|
|
|
|
"//upb/port:source_files",
|
2023-10-26 10:55:23 -07:00
|
|
|
"//upb/reflection:source_files",
|
2023-09-26 14:36:20 -07:00
|
|
|
"//upb/text:source_files",
|
|
|
|
|
"//upb/util:source_files",
|
|
|
|
|
"//upb/wire:source_files",
|
2023-08-04 08:55:54 -07:00
|
|
|
],
|
|
|
|
|
strip_prefix = strip_prefix.from_root(""),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# NOTE: This package currently only works for macos and ubuntu, MSVC users
|
|
|
|
|
# should use a binary wheel.
|
|
|
|
|
pkg_tar(
|
|
|
|
|
name = "source_tarball",
|
|
|
|
|
srcs = [
|
|
|
|
|
":dist_source_files",
|
|
|
|
|
":filegroup_source_files",
|
|
|
|
|
":generated_wkt",
|
|
|
|
|
":generated_wkt_compiler",
|
|
|
|
|
":utf8_range_source_files",
|
2023-09-12 13:06:39 -07:00
|
|
|
"//python:python_source_files",
|
2022-12-20 00:04:21 +00:00
|
|
|
],
|
2023-01-13 13:41:03 -08:00
|
|
|
extension = "tar.gz",
|
2023-02-02 09:10:18 -08:00
|
|
|
package_dir = "protobuf",
|
|
|
|
|
package_file_name = "protobuf.tar.gz",
|
2023-07-12 09:50:26 -07:00
|
|
|
strip_prefix = ".",
|
2023-03-29 16:51:09 -07:00
|
|
|
target_compatible_with = select({
|
|
|
|
|
"@system_python//:none": ["@platforms//:incompatible"],
|
|
|
|
|
"//conditions:default": [],
|
|
|
|
|
}),
|
2023-02-02 09:10:18 -08:00
|
|
|
)
|
|
|
|
|
|
2025-07-08 13:54:55 -07:00
|
|
|
sh_binary(
|
|
|
|
|
name = "setup_wrapper",
|
|
|
|
|
srcs = ["setup_wrapper.sh"],
|
|
|
|
|
data = [requirement("setuptools")],
|
|
|
|
|
visibility = ["//visibility:private"],
|
|
|
|
|
)
|
|
|
|
|
|
2023-02-02 09:10:18 -08:00
|
|
|
genrule(
|
|
|
|
|
name = "source_wheel",
|
|
|
|
|
srcs = [":source_tarball"],
|
|
|
|
|
outs = ["protobuf-%s.tar.gz" % PROTOBUF_PYTHON_VERSION],
|
|
|
|
|
cmd = """
|
|
|
|
|
set -eux
|
|
|
|
|
tar -xzvf $(location :source_tarball)
|
2025-07-08 13:54:55 -07:00
|
|
|
$(location :setup_wrapper) sdist
|
2023-02-02 09:10:18 -08:00
|
|
|
mv protobuf/dist/*.tar.gz $@
|
|
|
|
|
""",
|
2023-03-29 16:51:09 -07:00
|
|
|
target_compatible_with = select({
|
|
|
|
|
"@system_python//:none": ["@platforms//:incompatible"],
|
|
|
|
|
"//conditions:default": [],
|
|
|
|
|
}),
|
2025-07-08 13:54:55 -07:00
|
|
|
tools = [":setup_wrapper"],
|
2022-12-20 00:04:21 +00:00
|
|
|
)
|
|
|
|
|
|
2022-04-13 09:06:17 -07:00
|
|
|
py_wheel(
|
|
|
|
|
name = "binary_wheel",
|
|
|
|
|
abi = select({
|
|
|
|
|
"//conditions:default": "abi3",
|
|
|
|
|
}),
|
2022-05-26 11:19:09 -07:00
|
|
|
author = "protobuf@googlegroups.com",
|
|
|
|
|
author_email = "protobuf@googlegroups.com",
|
|
|
|
|
classifiers = [
|
|
|
|
|
"Programming Language :: Python",
|
|
|
|
|
"Programming Language :: Python :: 3",
|
|
|
|
|
"Programming Language :: Python :: 3.10",
|
2023-09-28 16:10:31 -07:00
|
|
|
"Programming Language :: Python :: 3.11",
|
2023-11-08 08:51:38 -08:00
|
|
|
"Programming Language :: Python :: 3.12",
|
2024-10-28 13:59:02 -07:00
|
|
|
"Programming Language :: Python :: 3.13",
|
2025-11-06 19:18:03 -08:00
|
|
|
"Programming Language :: Python :: 3.14",
|
2022-05-26 11:19:09 -07:00
|
|
|
],
|
2022-04-13 09:06:17 -07:00
|
|
|
distribution = "protobuf",
|
2022-12-05 11:13:38 -08:00
|
|
|
extra_distinfo_files = {
|
2023-09-20 16:52:54 -07:00
|
|
|
"//:LICENSE": "LICENSE",
|
2022-12-05 11:13:38 -08:00
|
|
|
},
|
2022-05-26 11:19:09 -07:00
|
|
|
homepage = "https://developers.google.com/protocol-buffers/",
|
|
|
|
|
license = "3-Clause BSD License",
|
2022-04-13 09:06:17 -07:00
|
|
|
platform = select({
|
2023-01-30 16:32:11 -08:00
|
|
|
":linux_x86_64_local": "linux_x86_64",
|
|
|
|
|
":linux_x86_64_release": "manylinux2014_x86_64",
|
|
|
|
|
":linux_aarch64_local": "linux_aarch64",
|
|
|
|
|
":linux_aarch64_release": "manylinux2014_aarch64",
|
2025-09-17 15:46:43 -07:00
|
|
|
":linux_s390x_local": "linux_s390x",
|
|
|
|
|
":linux_s390x_release": "manylinux2014_s390x",
|
2022-10-14 12:29:23 -07:00
|
|
|
":osx_universal2": "macosx_10_9_universal2",
|
|
|
|
|
":osx_aarch64": "macosx_11_0_arm64",
|
|
|
|
|
":windows_x86_32": "win32",
|
|
|
|
|
":windows_x86_64": "win_amd64",
|
2022-04-13 09:06:17 -07:00
|
|
|
"//conditions:default": "any",
|
|
|
|
|
}),
|
2026-01-09 14:18:02 -08:00
|
|
|
python_requires = ">=3.10",
|
2024-04-04 11:12:29 -07:00
|
|
|
# LINT.IfChange(python_tag)
|
2022-04-13 09:06:17 -07:00
|
|
|
python_tag = selects.with_or({
|
2023-09-26 14:36:20 -07:00
|
|
|
"//python:limited_api_3.10": "cp310",
|
2022-05-03 16:50:23 -07:00
|
|
|
"//conditions:default": "cp" + SYSTEM_PYTHON_VERSION,
|
2022-04-13 09:06:17 -07:00
|
|
|
}),
|
2024-04-04 11:12:29 -07:00
|
|
|
# LINT.ThenChange(
|
|
|
|
|
# :limited_api_wheels,
|
|
|
|
|
# )
|
2022-04-29 10:07:05 -07:00
|
|
|
strip_path_prefixes = [
|
2023-09-26 14:36:20 -07:00
|
|
|
"python/dist/",
|
2022-04-29 10:07:05 -07:00
|
|
|
"python/",
|
2022-07-13 15:00:01 -07:00
|
|
|
"src/",
|
2022-04-29 10:07:05 -07:00
|
|
|
],
|
2022-11-30 19:54:51 -08:00
|
|
|
target_compatible_with = select({
|
|
|
|
|
"@system_python//:none": ["@platforms//:incompatible"],
|
|
|
|
|
"//conditions:default": [],
|
|
|
|
|
}),
|
2022-05-09 22:00:33 -07:00
|
|
|
version = PROTOBUF_PYTHON_VERSION,
|
2022-04-13 09:06:17 -07:00
|
|
|
deps = [
|
|
|
|
|
":message_mod",
|
2023-01-13 13:41:03 -08:00
|
|
|
":plugin_py_pb2",
|
2022-04-13 09:06:17 -07:00
|
|
|
":well_known_proto_py_pb2",
|
2023-09-12 13:06:39 -07:00
|
|
|
"//:python_srcs",
|
2022-05-05 10:23:01 -07:00
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
py_wheel(
|
|
|
|
|
name = "pure_python_wheel",
|
|
|
|
|
abi = "none",
|
2022-05-26 11:19:09 -07:00
|
|
|
author = "protobuf@googlegroups.com",
|
|
|
|
|
author_email = "protobuf@googlegroups.com",
|
|
|
|
|
classifiers = [
|
|
|
|
|
"Programming Language :: Python",
|
|
|
|
|
"Programming Language :: Python :: 3",
|
|
|
|
|
"Programming Language :: Python :: 3.10",
|
2023-09-28 16:10:31 -07:00
|
|
|
"Programming Language :: Python :: 3.11",
|
2023-11-08 08:51:38 -08:00
|
|
|
"Programming Language :: Python :: 3.12",
|
2024-10-28 13:59:02 -07:00
|
|
|
"Programming Language :: Python :: 3.13",
|
2025-11-06 19:18:03 -08:00
|
|
|
"Programming Language :: Python :: 3.14",
|
2022-05-26 11:19:09 -07:00
|
|
|
],
|
2022-05-05 10:23:01 -07:00
|
|
|
distribution = "protobuf",
|
2022-12-05 11:13:38 -08:00
|
|
|
extra_distinfo_files = {
|
2023-09-20 16:52:54 -07:00
|
|
|
"//:LICENSE": "LICENSE",
|
2022-12-05 11:13:38 -08:00
|
|
|
},
|
2022-05-26 11:19:09 -07:00
|
|
|
homepage = "https://developers.google.com/protocol-buffers/",
|
|
|
|
|
license = "3-Clause BSD License",
|
2022-05-05 10:23:01 -07:00
|
|
|
platform = "any",
|
2026-01-09 14:18:02 -08:00
|
|
|
python_requires = ">=3.10",
|
2022-05-05 10:23:01 -07:00
|
|
|
python_tag = "py3",
|
|
|
|
|
strip_path_prefixes = [
|
|
|
|
|
"python/",
|
2022-07-13 15:00:01 -07:00
|
|
|
"src/",
|
2022-05-05 10:23:01 -07:00
|
|
|
],
|
2022-11-30 19:54:51 -08:00
|
|
|
target_compatible_with = select({
|
|
|
|
|
"@system_python//:none": ["@platforms//:incompatible"],
|
|
|
|
|
"//conditions:default": [],
|
|
|
|
|
}),
|
2022-05-09 22:00:33 -07:00
|
|
|
version = PROTOBUF_PYTHON_VERSION,
|
2022-05-05 10:23:01 -07:00
|
|
|
deps = [
|
2023-01-13 13:41:03 -08:00
|
|
|
":plugin_py_pb2",
|
2022-05-05 10:23:01 -07:00
|
|
|
":well_known_proto_py_pb2",
|
2023-09-12 13:06:39 -07:00
|
|
|
"//:python_srcs",
|
2022-04-13 09:06:17 -07:00
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2022-05-03 16:50:23 -07:00
|
|
|
py_wheel(
|
|
|
|
|
name = "test_wheel",
|
2022-07-13 15:00:01 -07:00
|
|
|
testonly = True,
|
2022-05-03 16:50:23 -07:00
|
|
|
abi = "none",
|
|
|
|
|
distribution = "protobuftests",
|
2022-12-05 11:13:38 -08:00
|
|
|
extra_distinfo_files = {
|
2023-09-20 16:52:54 -07:00
|
|
|
"//:LICENSE": "LICENSE",
|
2022-12-05 11:13:38 -08:00
|
|
|
},
|
2022-05-03 16:50:23 -07:00
|
|
|
platform = "any",
|
|
|
|
|
python_tag = "py3",
|
2022-07-13 15:00:01 -07:00
|
|
|
strip_path_prefixes = [
|
|
|
|
|
"python/",
|
|
|
|
|
"src/",
|
|
|
|
|
],
|
2022-11-30 19:54:51 -08:00
|
|
|
target_compatible_with = select({
|
|
|
|
|
"@system_python//:none": ["@platforms//:incompatible"],
|
|
|
|
|
"//conditions:default": [],
|
|
|
|
|
}),
|
2022-05-09 22:00:33 -07:00
|
|
|
version = PROTOBUF_PYTHON_VERSION,
|
2022-05-03 16:50:23 -07:00
|
|
|
deps = [
|
2023-09-12 13:06:39 -07:00
|
|
|
"//:python_common_test_protos",
|
|
|
|
|
"//:python_specific_test_protos",
|
|
|
|
|
"//:python_test_srcs",
|
|
|
|
|
"//src/google/protobuf:testdata",
|
2024-12-16 18:52:17 -08:00
|
|
|
"@com_google_absl_py//absl/testing:parameterized",
|
2022-05-03 16:50:23 -07:00
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2022-04-13 09:06:17 -07:00
|
|
|
py_dist(
|
|
|
|
|
name = "dist",
|
|
|
|
|
binary_wheel = ":binary_wheel",
|
|
|
|
|
full_api_cpus = [
|
2022-05-12 14:27:08 -07:00
|
|
|
"win32",
|
2022-04-13 09:06:17 -07:00
|
|
|
"win64",
|
|
|
|
|
],
|
|
|
|
|
# Limited API: these wheels will satisfy any Python version >= the
|
|
|
|
|
# given version.
|
|
|
|
|
#
|
|
|
|
|
# Technically the limited API doesn't have the functions we need until
|
2024-04-04 11:12:29 -07:00
|
|
|
# 3.10, but on Linux we can get away with using 3.1+ (see ../python_api.h for
|
2022-04-13 09:06:17 -07:00
|
|
|
# details).
|
2024-04-04 11:12:29 -07:00
|
|
|
# LINT.IfChange(limited_api_wheels)
|
2022-04-13 09:06:17 -07:00
|
|
|
limited_api_wheels = {
|
2022-05-12 14:27:08 -07:00
|
|
|
"win32": "310",
|
2022-04-13 09:06:17 -07:00
|
|
|
"win64": "310",
|
2026-01-09 14:18:02 -08:00
|
|
|
"linux-x86_64": "310",
|
|
|
|
|
"linux-aarch_64": "310",
|
|
|
|
|
"linux-s390_64": "310",
|
|
|
|
|
"osx-universal2": "310",
|
2022-04-13 09:06:17 -07:00
|
|
|
},
|
2024-04-04 11:12:29 -07:00
|
|
|
# LINT.ThenChange(:python_tag)
|
2022-05-05 10:23:01 -07:00
|
|
|
pure_python_wheel = ":pure_python_wheel",
|
2022-04-13 09:06:17 -07:00
|
|
|
tags = ["manual"],
|
|
|
|
|
)
|
2024-04-03 01:34:28 -07:00
|
|
|
|
|
|
|
|
# py_proto_library() is private rule, only intended for internal use by upb.
|
|
|
|
|
# Hopefully py_proto_library() will eventually be available in rules_proto or
|
|
|
|
|
# another upstream package.
|
|
|
|
|
bzl_library(
|
|
|
|
|
name = "py_proto_library_bzl",
|
|
|
|
|
srcs = ["py_proto_library.bzl"],
|
|
|
|
|
deps = [
|
|
|
|
|
"@rules_python//python:py_info_bzl",
|
|
|
|
|
],
|
|
|
|
|
)
|