File tree 12 files changed +84
-2
lines changed
12 files changed +84
-2
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,14 @@ new_local_repository(
79
79
path = "./third_party/protobuf/3.6.1/" ,
80
80
)
81
81
82
+ # This is a mock version of bazelbuild/rules_python that contains only
83
+ # @rules_python//python:defs.bzl. It is used by protobuf.
84
+ # TODO(#9029): We could potentially replace this with the real @rules_python.
85
+ local_repository (
86
+ name = "rules_python" ,
87
+ path = "./third_party/rules_python" ,
88
+ )
89
+
82
90
local_repository (
83
91
name = "googleapis" ,
84
92
path = "./third_party/googleapis/" ,
Original file line number Diff line number Diff line change
1
+ # Needed for #9006. Consider replacing label with @rules_python as per #9029 if
2
+ # merging from upstream becomes an issue.
3
+ load ("//tools/python:private/defs.bzl" , "py_test" )
4
+
1
5
licenses (["notice" ]) # 3-clause BSD
2
6
3
7
package (
Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ config_setting(
21
21
22
22
load (":protobuf.bzl" , "py_proto_library" )
23
23
load (":compiler_config_setting.bzl" , "create_compiler_config_setting" )
24
+ # Needed for #9006. Hopefully a future upstream version will include this line.
25
+ load ("@rules_python//python:defs.bzl" , "py_library" )
24
26
25
27
filegroup (
26
28
name = "srcs" ,
Original file line number Diff line number Diff line change
1
+ # Needed for #9006. Hopefully a future upstream version will include this line.
2
+ load ("@rules_python//python:defs.bzl" , "py_library" , "py_test" )
3
+
1
4
def _GetPath (ctx , path ):
2
5
if ctx .label .workspace_root :
3
6
return ctx .label .workspace_root + "/" + path
@@ -383,7 +386,7 @@ def py_proto_library(
383
386
if default_runtime and not default_runtime in py_libs + deps :
384
387
py_libs = py_libs + [default_runtime ]
385
388
386
- native . py_library (
389
+ py_library (
387
390
name = name ,
388
391
srcs = outs + py_extra_srcs ,
389
392
deps = py_libs + deps ,
@@ -406,7 +409,7 @@ def internal_protobuf_py_tests(
406
409
"""
407
410
for m in modules :
408
411
s = "python/google/protobuf/internal/%s.py" % m
409
- native . py_test (
412
+ py_test (
410
413
name = "py_%s" % m ,
411
414
srcs = [s ],
412
415
main = s ,
Original file line number Diff line number Diff line change
1
+ # Needed for #9006. Consider replacing label with @rules_python as per #9029 if
2
+ # merging from upstream becomes an issue.
3
+ load ("//tools/python:private/defs.bzl" , "py_library" )
4
+
1
5
licenses (["notice" ])
2
6
3
7
filegroup (
Original file line number Diff line number Diff line change
1
+ # Needed for #9006. Consider replacing label with @rules_python as per #9029 if
2
+ # merging from upstream becomes an issue.
3
+ load ("//tools/python:private/defs.bzl" , "py_library" )
4
+
1
5
licenses (["notice" ])
2
6
3
7
filegroup (
Original file line number Diff line number Diff line change
1
+ # Needed for #9006. Consider replacing label with @rules_python as per #9029 if
2
+ # merging from upstream becomes an issue.
3
+ load ("//tools/python:private/defs.bzl" , "py_library" )
4
+
1
5
licenses (["notice" ])
2
6
3
7
filegroup (
Original file line number Diff line number Diff line change
1
+ # Needed for #9006. Consider replacing label with @rules_python as per #9029 if
2
+ # merging from upstream becomes an issue.
3
+ load ("//tools/python:private/defs.bzl" , "py_library" )
4
+
1
5
licenses (["notice" ])
2
6
3
7
filegroup (
Original file line number Diff line number Diff line change
1
+ # Needed for #9006. We can't easily replace this label with a @rules_python
2
+ # label (#9029) because this file is used in both @io_bazel and @bazel_tools,
3
+ # the latter of which can't reference other repos.
4
+ load ("//tools/python:private/defs.bzl" , "py_library" )
5
+
1
6
licenses (["notice" ])
2
7
3
8
filegroup (
Original file line number Diff line number Diff line change
1
+ # A stub version of bazelbuild/rules_python that contains only the defs.bzl
2
+ # file, which is needed to access native Python rules under
3
+ # --incompatible_load_python_rules_from_bzl (#9006).
4
+ #
5
+ # TODO(#9029): Maybe replace this with the real thing.
6
+
7
+ workspace (name = "rules_python" )
Original file line number Diff line number Diff line change
1
+ # This file intentionally left blank.
Original file line number Diff line number Diff line change
1
+ # Copyright 2019 The Bazel Authors. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ """This file is selectively copied from //tools/python:private/defs.bzl."""
16
+
17
+ _MIGRATION_TAG = "__PYTHON_RULES_MIGRATION_DO_NOT_USE_WILL_BREAK__"
18
+
19
+ def _add_tags (attrs ):
20
+ if "tags" in attrs and attrs ["tags" ] != None :
21
+ attrs ["tags" ] += [_MIGRATION_TAG ]
22
+ else :
23
+ attrs ["tags" ] = [_MIGRATION_TAG ]
24
+ return attrs
25
+
26
+ def py_library (** attrs ):
27
+ native .py_library (** _add_tags (attrs ))
28
+
29
+ def py_binary (** attrs ):
30
+ native .py_binary (** _add_tags (attrs ))
31
+
32
+ def py_test (** attrs ):
33
+ native .py_test (** _add_tags (attrs ))
34
+
35
+ def py_runtime (** attrs ):
36
+ native .py_runtime (** _add_tags (attrs ))
You can’t perform that action at this time.
0 commit comments