diff --git a/pybind11_protobuf/BUILD b/pybind11_protobuf/BUILD index f34fab0..00cea18 100644 --- a/pybind11_protobuf/BUILD +++ b/pybind11_protobuf/BUILD @@ -11,7 +11,7 @@ pybind_library( "//visibility:public", ], deps = [ - "@com_google_protobuf//:protobuf", + "//net/proto2/public", ], ) @@ -25,8 +25,8 @@ pybind_library( ":check_unknown_fields", ":enum_type_caster", ":proto_cast_util", + "//net/proto2/public", "@com_google_absl//absl/strings:string_view", - "@com_google_protobuf//:protobuf", ], ) @@ -39,6 +39,8 @@ pybind_library( ], deps = [ ":check_unknown_fields", + "//net/proto2/proto:descriptor_cc_proto", + "//net/proto2/public", "@com_google_absl//absl/container:flat_hash_map", "@com_google_absl//absl/log", "@com_google_absl//absl/log:check", @@ -58,9 +60,9 @@ pybind_library( ], deps = [ ":proto_cast_util", + "//net/proto2/public", "@com_google_absl//absl/status:statusor", "@com_google_absl//absl/types:optional", - "@com_google_protobuf//:protobuf", ], ) @@ -69,13 +71,13 @@ cc_library( srcs = ["check_unknown_fields.cc"], hdrs = ["check_unknown_fields.h"], deps = [ + "//net/proto2/public", + "//net/proto2/python/public:proto_api", "@com_google_absl//absl/container:flat_hash_map", "@com_google_absl//absl/container:flat_hash_set", "@com_google_absl//absl/meta:type_traits", "@com_google_absl//absl/strings", "@com_google_absl//absl/synchronization", - "@com_google_protobuf//:protobuf", - "@com_google_protobuf//python:proto_api", ], ) diff --git a/pybind11_protobuf/check_unknown_fields.cc b/pybind11_protobuf/check_unknown_fields.cc index 0639d09..982cf48 100644 --- a/pybind11_protobuf/check_unknown_fields.cc +++ b/pybind11_protobuf/check_unknown_fields.cc @@ -6,9 +6,9 @@ #include #include -#include "google/protobuf/descriptor.h" -#include "google/protobuf/message.h" -#include "google/protobuf/unknown_field_set.h" +#include "net/proto2/public/descriptor.h" +#include "net/proto2/public/message.h" +#include "net/proto2/public/unknown_field_set.h" #include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_set.h" #include "absl/strings/str_cat.h" diff --git a/pybind11_protobuf/check_unknown_fields.h b/pybind11_protobuf/check_unknown_fields.h index 79ac001..5a6d4ac 100644 --- a/pybind11_protobuf/check_unknown_fields.h +++ b/pybind11_protobuf/check_unknown_fields.h @@ -3,8 +3,8 @@ #include -#include "google/protobuf/message.h" -#include "python/google/protobuf/proto_api.h" +#include "net/proto2/public/message.h" +#include "net/proto2/python/public/proto_api.h" #include "absl/strings/string_view.h" namespace pybind11_protobuf::check_unknown_fields { diff --git a/pybind11_protobuf/enum_type_caster.h b/pybind11_protobuf/enum_type_caster.h index d30369b..5daa6f1 100644 --- a/pybind11_protobuf/enum_type_caster.h +++ b/pybind11_protobuf/enum_type_caster.h @@ -14,9 +14,9 @@ #include #include -#include "google/protobuf/descriptor.h" -#include "google/protobuf/generated_enum_reflection.h" -#include "google/protobuf/generated_enum_util.h" +#include "net/proto2/public/descriptor.h" +#include "net/proto2/public/generated_enum_reflection.h" +#include "net/proto2/public/generated_enum_util.h" // pybind11 type_caster specialization which translates Proto::Enum types // to/from ints. This will have ODR conflicts when users specify wrappers for diff --git a/pybind11_protobuf/native_proto_caster.h b/pybind11_protobuf/native_proto_caster.h index 6d020e0..82db2ad 100644 --- a/pybind11_protobuf/native_proto_caster.h +++ b/pybind11_protobuf/native_proto_caster.h @@ -18,7 +18,7 @@ #include #include -#include "google/protobuf/message.h" +#include "net/proto2/public/message.h" #include "absl/strings/string_view.h" #include "pybind11_protobuf/enum_type_caster.h" #include "pybind11_protobuf/proto_caster_impl.h" diff --git a/pybind11_protobuf/proto_cast_util.cc b/pybind11_protobuf/proto_cast_util.cc index c2acac9..8d1fd1e 100644 --- a/pybind11_protobuf/proto_cast_util.cc +++ b/pybind11_protobuf/proto_cast_util.cc @@ -13,7 +13,7 @@ #include #include -#include "google/protobuf/descriptor.pb.h" +#include "net/proto2/proto/descriptor.pb.h" #include "absl/container/flat_hash_map.h" #include "absl/log/check.h" #include "absl/log/log.h" @@ -183,11 +183,11 @@ GlobalState::GlobalState() { // pybind11_protobuf casting needs a dependency on proto internals to work. try { - ImportCached("google.protobuf.descriptor"); + ImportCached("google3.net.proto2.python.public.descriptor"); auto descriptor_pool = - ImportCached("google.protobuf.descriptor_pool"); + ImportCached("google3.net.proto2.python.public.descriptor_pool"); auto message_factory = - ImportCached("google.protobuf.message_factory"); + ImportCached("google3.net.proto2.python.public.message_factory"); global_pool_ = descriptor_pool.attr("Default")(); find_message_type_by_name_ = global_pool_.attr("FindMessageTypeByName"); if (hasattr(message_factory, "GetMessageClass")) { diff --git a/pybind11_protobuf/proto_cast_util.h b/pybind11_protobuf/proto_cast_util.h index f2ff440..70c0eec 100644 --- a/pybind11_protobuf/proto_cast_util.h +++ b/pybind11_protobuf/proto_cast_util.h @@ -12,8 +12,8 @@ #include #include -#include "google/protobuf/descriptor.h" -#include "google/protobuf/message.h" +#include "net/proto2/public/descriptor.h" +#include "net/proto2/public/message.h" #include "absl/strings/string_view.h" #include "absl/types/optional.h" diff --git a/pybind11_protobuf/proto_caster_impl.h b/pybind11_protobuf/proto_caster_impl.h index 12e693d..db769f2 100644 --- a/pybind11_protobuf/proto_caster_impl.h +++ b/pybind11_protobuf/proto_caster_impl.h @@ -15,9 +15,9 @@ #include #include -#include "google/protobuf/descriptor.pb.h" -#include "google/protobuf/descriptor.h" -#include "google/protobuf/message.h" +#include "net/proto2/proto/descriptor.pb.h" +#include "net/proto2/public/descriptor.h" +#include "net/proto2/public/message.h" #include "pybind11_protobuf/proto_cast_util.h" // Enables unsafe conversions; currently these are a work in progress. diff --git a/pybind11_protobuf/proto_utils.cc b/pybind11_protobuf/proto_utils.cc index 2701727..ed9acb4 100644 --- a/pybind11_protobuf/proto_utils.cc +++ b/pybind11_protobuf/proto_utils.cc @@ -12,10 +12,10 @@ #include #include -#include "google/protobuf/descriptor.pb.h" -#include "google/protobuf/descriptor.h" -#include "google/protobuf/message.h" -#include "google/protobuf/reflection.h" +#include "net/proto2/proto/descriptor.pb.h" +#include "net/proto2/public/descriptor.h" +#include "net/proto2/public/message.h" +#include "net/proto2/public/reflection.h" #include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" diff --git a/pybind11_protobuf/proto_utils.h b/pybind11_protobuf/proto_utils.h index 1b2c084..2ccca62 100644 --- a/pybind11_protobuf/proto_utils.h +++ b/pybind11_protobuf/proto_utils.h @@ -10,7 +10,7 @@ #include -#include "google/protobuf/message.h" +#include "net/proto2/public/message.h" namespace pybind11 { namespace google { diff --git a/pybind11_protobuf/tests/BUILD b/pybind11_protobuf/tests/BUILD index 2cca967..be92ad2 100644 --- a/pybind11_protobuf/tests/BUILD +++ b/pybind11_protobuf/tests/BUILD @@ -140,8 +140,9 @@ pybind_extension( name = "dynamic_message_module", srcs = ["dynamic_message_module.cc"], deps = [ + "//net/proto2/proto:descriptor_cc_proto", + "//net/proto2/public", "//pybind11_protobuf:native_proto_caster", - "@com_google_protobuf//:protobuf", ], ) @@ -170,7 +171,7 @@ pybind_extension( ":extension_in_other_file_in_deps_cc_proto", ":extension_nest_repeated_cc_proto", ":test_cc_proto", - "@com_google_protobuf//:protobuf", + "//net/proto2/public", "//pybind11_protobuf:native_proto_caster", ], ) @@ -202,8 +203,8 @@ pybind_extension( srcs = ["message_module.cc"], deps = [ ":test_cc_proto", + "//net/proto2/public", "//pybind11_protobuf:native_proto_caster", - "@com_google_protobuf//:protobuf", ], ) @@ -232,8 +233,9 @@ pybind_extension( srcs = ["pass_by_module.cc"], deps = [ ":test_cc_proto", + "//net/proto2/proto:descriptor_cc_proto", + "//net/proto2/public", "//pybind11_protobuf:native_proto_caster", - "@com_google_protobuf//:protobuf", ], ) @@ -257,8 +259,8 @@ pybind_extension( name = "pass_proto2_message_module", srcs = ["pass_proto2_message_module.cc"], deps = [ + "//net/proto2/public", "//pybind11_protobuf:native_proto_caster", - "@com_google_protobuf//:protobuf", ], ) @@ -269,10 +271,10 @@ pybind_extension( srcs = ["wrapped_proto_module.cc"], deps = [ ":test_cc_proto", + "//net/proto2/public", "//pybind11_protobuf:wrapped_proto_caster", "@com_google_absl//absl/status:statusor", "@com_google_absl//absl/types:optional", - "@com_google_protobuf//:protobuf", ], ) @@ -322,8 +324,8 @@ pybind_extension( name = "regression_wrappers_module", srcs = ["regression_wrappers_module.cc"], deps = [ + "//net/proto2/public", "//pybind11_protobuf:native_proto_caster", - "@com_google_protobuf//:protobuf", ], ) diff --git a/pybind11_protobuf/tests/compare.py b/pybind11_protobuf/tests/compare.py index 2023417..d5591c7 100644 --- a/pybind11_protobuf/tests/compare.py +++ b/pybind11_protobuf/tests/compare.py @@ -47,10 +47,10 @@ def testXXX(self): import collections.abc as collections_abc import difflib -from google.protobuf import descriptor -from google.protobuf import descriptor_pool -from google.protobuf import message -from google.protobuf import text_format +from google3.net.proto2.python.public import descriptor +from google3.net.proto2.python.public import descriptor_pool +from google3.net.proto2.python.public import message +from google3.net.proto2.python.public import text_format def assertProtoEqual(self, a, b, check_initialized=True, # pylint: disable=invalid-name diff --git a/pybind11_protobuf/tests/dynamic_message_module.cc b/pybind11_protobuf/tests/dynamic_message_module.cc index 21edd96..2929d76 100644 --- a/pybind11_protobuf/tests/dynamic_message_module.cc +++ b/pybind11_protobuf/tests/dynamic_message_module.cc @@ -9,11 +9,11 @@ #include #include -#include "google/protobuf/descriptor.pb.h" -#include "google/protobuf/descriptor.h" -#include "google/protobuf/dynamic_message.h" -#include "google/protobuf/message.h" -#include "google/protobuf/text_format.h" +#include "net/proto2/proto/descriptor.pb.h" +#include "net/proto2/public/descriptor.h" +#include "net/proto2/public/dynamic_message.h" +#include "net/proto2/public/message.h" +#include "net/proto2/public/text_format.h" #include "pybind11_protobuf/native_proto_caster.h" namespace py = ::pybind11; diff --git a/pybind11_protobuf/tests/dynamic_message_test.py b/pybind11_protobuf/tests/dynamic_message_test.py index d81ce61..4787999 100644 --- a/pybind11_protobuf/tests/dynamic_message_test.py +++ b/pybind11_protobuf/tests/dynamic_message_test.py @@ -11,9 +11,9 @@ from absl.testing import absltest from absl.testing import parameterized -from google.protobuf import descriptor_pb2 -from google.protobuf import descriptor_pool -from google.protobuf import message_factory +from google3.net.proto2.proto import descriptor_pb2 +from google3.net.proto2.python.public import descriptor_pool +from google3.net.proto2.python.public import message_factory from pybind11_protobuf.tests import compare from pybind11_protobuf.tests import dynamic_message_module as m from pybind11_protobuf.tests import test_pb2 diff --git a/pybind11_protobuf/tests/extension_module.cc b/pybind11_protobuf/tests/extension_module.cc index c14c8ac..ed822de 100644 --- a/pybind11_protobuf/tests/extension_module.cc +++ b/pybind11_protobuf/tests/extension_module.cc @@ -9,7 +9,7 @@ #include #include -#include "google/protobuf/message.h" +#include "net/proto2/public/message.h" #include "pybind11_protobuf/native_proto_caster.h" #include "pybind11_protobuf/tests/extension.pb.h" #include "pybind11_protobuf/tests/extension_nest_repeated.pb.h" diff --git a/pybind11_protobuf/tests/message_module.cc b/pybind11_protobuf/tests/message_module.cc index 61f5579..97075b5 100644 --- a/pybind11_protobuf/tests/message_module.cc +++ b/pybind11_protobuf/tests/message_module.cc @@ -9,8 +9,8 @@ #include #include -#include "google/protobuf/message.h" -#include "google/protobuf/text_format.h" +#include "net/proto2/public/message.h" +#include "net/proto2/public/text_format.h" #include "pybind11_protobuf/native_proto_caster.h" #include "pybind11_protobuf/tests/test.pb.h" diff --git a/pybind11_protobuf/tests/message_test.py b/pybind11_protobuf/tests/message_test.py index a92caea..7b96709 100644 --- a/pybind11_protobuf/tests/message_test.py +++ b/pybind11_protobuf/tests/message_test.py @@ -19,7 +19,7 @@ from pybind11_protobuf.tests import compare from pybind11_protobuf.tests import message_module as m from pybind11_protobuf.tests import test_pb2 -from google.protobuf import text_format +from google3.net.proto2.python.public import text_format def get_py_message(): diff --git a/pybind11_protobuf/tests/pass_by_module.cc b/pybind11_protobuf/tests/pass_by_module.cc index b2c4ae8..0d39dc6 100644 --- a/pybind11_protobuf/tests/pass_by_module.cc +++ b/pybind11_protobuf/tests/pass_by_module.cc @@ -11,10 +11,10 @@ #include #include -#include "google/protobuf/descriptor.pb.h" -#include "google/protobuf/descriptor.h" -#include "google/protobuf/dynamic_message.h" -#include "google/protobuf/message.h" +#include "net/proto2/proto/descriptor.pb.h" +#include "net/proto2/public/descriptor.h" +#include "net/proto2/public/dynamic_message.h" +#include "net/proto2/public/message.h" #include "pybind11_protobuf/native_proto_caster.h" #include "pybind11_protobuf/tests/test.pb.h" diff --git a/pybind11_protobuf/tests/pass_by_test.py b/pybind11_protobuf/tests/pass_by_test.py index 56a69fc..0b44442 100644 --- a/pybind11_protobuf/tests/pass_by_test.py +++ b/pybind11_protobuf/tests/pass_by_test.py @@ -12,8 +12,8 @@ from pybind11_protobuf.tests import pass_by_module as m from pybind11_protobuf.tests import test_pb2 -from google.protobuf import descriptor_pool -from google.protobuf import message_factory +from google3.net.proto2.python.public import descriptor_pool +from google3.net.proto2.python.public import message_factory def get_abstract_pass_by_params(): diff --git a/pybind11_protobuf/tests/pass_proto2_message_module.cc b/pybind11_protobuf/tests/pass_proto2_message_module.cc index c8c34b8..5993c4a 100644 --- a/pybind11_protobuf/tests/pass_proto2_message_module.cc +++ b/pybind11_protobuf/tests/pass_proto2_message_module.cc @@ -7,7 +7,7 @@ #include -#include "google/protobuf/message.h" +#include "net/proto2/public/message.h" #include "pybind11_protobuf/native_proto_caster.h" PYBIND11_MODULE(pass_proto2_message_module, m) { diff --git a/pybind11_protobuf/tests/regression_wrappers_module.cc b/pybind11_protobuf/tests/regression_wrappers_module.cc index 1c246cb..374fc52 100644 --- a/pybind11_protobuf/tests/regression_wrappers_module.cc +++ b/pybind11_protobuf/tests/regression_wrappers_module.cc @@ -5,8 +5,8 @@ #include -#include "google/protobuf/descriptor.h" -#include "google/protobuf/message.h" +#include "net/proto2/public/descriptor.h" +#include "net/proto2/public/message.h" #include "pybind11_protobuf/native_proto_caster.h" namespace { diff --git a/pybind11_protobuf/tests/wrapped_proto_module.cc b/pybind11_protobuf/tests/wrapped_proto_module.cc index 3d7f0dc..6869671 100644 --- a/pybind11_protobuf/tests/wrapped_proto_module.cc +++ b/pybind11_protobuf/tests/wrapped_proto_module.cc @@ -11,7 +11,7 @@ #include #include -#include "google/protobuf/dynamic_message.h" +#include "net/proto2/public/dynamic_message.h" #include "absl/status/statusor.h" #include "absl/types/optional.h" #include "pybind11_protobuf/tests/test.pb.h" diff --git a/pybind11_protobuf/wrapped_proto_caster.h b/pybind11_protobuf/wrapped_proto_caster.h index 18cf7da..db7c62c 100644 --- a/pybind11_protobuf/wrapped_proto_caster.h +++ b/pybind11_protobuf/wrapped_proto_caster.h @@ -14,7 +14,7 @@ #include #include -#include "google/protobuf/message.h" +#include "net/proto2/public/message.h" #include "absl/status/statusor.h" #include "absl/types/optional.h" #include "pybind11_protobuf/proto_cast_util.h"