@@ -12,6 +12,7 @@ load("//:protobuf.bzl", "internal_py_proto_library")
12
12
load ("//build_defs:arch_tests.bzl" , "aarch64_test" , "x86_64_test" )
13
13
load ("//build_defs:cpp_opts.bzl" , "COPTS" )
14
14
load ("//conformance:defs.bzl" , "conformance_test" )
15
+ load ("//src/google/protobuf/editions:defaults.bzl" , "compile_edition_defaults" , "embed_edition_defaults" )
15
16
load (":internal.bzl" , "internal_copy_files" , "internal_py_test" )
16
17
17
18
def build_targets (name ):
@@ -143,8 +144,23 @@ def build_targets(name):
143
144
],
144
145
)
145
146
146
- py_library (
147
- name = "python_srcs" ,
147
+ compile_edition_defaults (
148
+ name = "python_edition_defaults" ,
149
+ srcs = ["//:descriptor_proto" ],
150
+ maximum_edition = "2023" ,
151
+ minimum_edition = "PROTO2" ,
152
+ )
153
+
154
+ embed_edition_defaults (
155
+ name = "embedded_python_edition_defaults_generate" ,
156
+ defaults = "python_edition_defaults" ,
157
+ output = "google/protobuf/internal/python_edition_defaults.py" ,
158
+ placeholder = "DEFAULTS_VALUE" ,
159
+ template = "google/protobuf/internal/python_edition_defaults.py.template" ,
160
+ )
161
+
162
+ native .filegroup (
163
+ name = "python_src_files" ,
148
164
srcs = native .glob (
149
165
[
150
166
"google/protobuf/**/*.py" ,
@@ -154,7 +170,12 @@ def build_targets(name):
154
170
"google/protobuf/internal/test_util.py" ,
155
171
"google/protobuf/internal/import_test_package/__init__.py" ,
156
172
],
157
- ),
173
+ ) + ["google/protobuf/internal/python_edition_defaults.py" ],
174
+ )
175
+
176
+ py_library (
177
+ name = "python_srcs" ,
178
+ srcs = [":python_src_files" ],
158
179
imports = ["python" ],
159
180
srcs_version = "PY2AND3" ,
160
181
visibility = [
@@ -196,19 +217,13 @@ def build_targets(name):
196
217
)
197
218
198
219
internal_copy_files (
199
- name = "copied_test_messages_proto2_files " ,
220
+ name = "copied_conformance_test_files " ,
200
221
testonly = 1 ,
201
222
srcs = [
202
223
"//src/google/protobuf:test_messages_proto2.proto" ,
203
- ],
204
- strip_prefix = "src" ,
205
- )
206
-
207
- internal_copy_files (
208
- name = "copied_test_messages_proto3_files" ,
209
- testonly = 1 ,
210
- srcs = [
211
224
"//src/google/protobuf:test_messages_proto3.proto" ,
225
+ "//src/google/protobuf/editions:golden/test_messages_proto2_editions.proto" ,
226
+ "//src/google/protobuf/editions:golden/test_messages_proto3_editions.proto" ,
212
227
],
213
228
strip_prefix = "src" ,
214
229
)
@@ -241,22 +256,9 @@ def build_targets(name):
241
256
)
242
257
243
258
internal_py_proto_library (
244
- name = "test_messages_proto2_py_proto" ,
245
- testonly = 1 ,
246
- srcs = [":copied_test_messages_proto2_files" ],
247
- include = "." ,
248
- default_runtime = "//:protobuf_python" ,
249
- protoc = "//:protoc" ,
250
- visibility = [
251
- "//conformance:__pkg__" ,
252
- "//python:__subpackages__" ,
253
- ],
254
- )
255
-
256
- internal_py_proto_library (
257
- name = "test_messages_proto3_py_proto" ,
259
+ name = "conformance_test_py_proto" ,
258
260
testonly = 1 ,
259
- srcs = [":copied_test_messages_proto3_files " ],
261
+ srcs = [":copied_conformance_test_files " ],
260
262
include = "." ,
261
263
default_runtime = "//:protobuf_python" ,
262
264
protoc = "//:protoc" ,
@@ -404,6 +406,7 @@ def build_targets(name):
404
406
":use_fast_cpp_protos" : ["@platforms//:incompatible" ],
405
407
"//conditions:default" : [],
406
408
}),
409
+ maximum_edition = "2023" ,
407
410
testee = "//conformance:conformance_python" ,
408
411
text_format_failure_list = "//conformance:text_format_failure_list_python.txt" ,
409
412
)
@@ -418,6 +421,7 @@ def build_targets(name):
418
421
":use_fast_cpp_protos" : [],
419
422
"//conditions:default" : ["@platforms//:incompatible" ],
420
423
}),
424
+ maximum_edition = "2023" ,
421
425
testee = "//conformance:conformance_python" ,
422
426
text_format_failure_list = "//conformance:text_format_failure_list_python_cpp.txt" ,
423
427
)
@@ -428,16 +432,8 @@ def build_targets(name):
428
432
429
433
pkg_files (
430
434
name = "python_source_files" ,
431
- srcs = native .glob (
432
- [
433
- "google/protobuf/**/*.py" ,
434
- ],
435
- exclude = [
436
- "google/protobuf/internal/*_test.py" ,
437
- "google/protobuf/internal/test_util.py" ,
438
- "google/protobuf/internal/import_test_package/__init__.py" ,
439
- ],
440
- ) + [
435
+ srcs = [
436
+ ":python_src_files" ,
441
437
"README.md" ,
442
438
"google/__init__.py" ,
443
439
"setup.cfg" ,
0 commit comments