Skip to content

Commit b871ba7

Browse files
committed
Add load() statements for Python rules in third_party
This replaces all direct uses of the native Python rules underneath the third_party/ directory with load()s of the internal wrapper macros. These macros are needed for compatibility with `--incompatible_load_python_rules_from_bzl`. Work toward bazelbuild#9006. RELNOTES: None
1 parent a2732d8 commit b871ba7

File tree

9 files changed

+19
-2
lines changed

9 files changed

+19
-2
lines changed

third_party/def_parser/BUILD

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
load("@io_bazel//tools/python:private/defs.bzl", "py_test")
2+
13
licenses(["notice"]) # 3-clause BSD
24

35
package(

third_party/protobuf/3.6.1/BUILD

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ config_setting(
2121

2222
load(":protobuf.bzl", "py_proto_library")
2323
load(":compiler_config_setting.bzl", "create_compiler_config_setting")
24+
load("@io_bazel//tools/python:private/defs.bzl", "py_library")
2425

2526
filegroup(
2627
name = "srcs",

third_party/protobuf/3.6.1/protobuf.bzl

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
load("@io_bazel//tools/python:private/defs.bzl", "py_library", "py_test")
2+
13
def _GetPath(ctx, path):
24
if ctx.label.workspace_root:
35
return ctx.label.workspace_root + "/" + path
@@ -383,7 +385,7 @@ def py_proto_library(
383385
if default_runtime and not default_runtime in py_libs + deps:
384386
py_libs = py_libs + [default_runtime]
385387

386-
native.py_library(
388+
py_library(
387389
name = name,
388390
srcs = outs + py_extra_srcs,
389391
deps = py_libs + deps,
@@ -406,7 +408,7 @@ def internal_protobuf_py_tests(
406408
"""
407409
for m in modules:
408410
s = "python/google/protobuf/internal/%s.py" % m
409-
native.py_test(
411+
py_test(
410412
name = "py_%s" % m,
411413
srcs = [s],
412414
main = s,

third_party/protobuf/3.6.1/six.BUILD

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
load("@io_bazel//tools/python:private/defs.bzl", "py_library")
2+
13
genrule(
24
name = "copy_six",
35
srcs = ["six-1.10.0/six.py"],

third_party/py/abseil/BUILD

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
load("@io_bazel//tools/python:private/defs.bzl", "py_library")
2+
13
licenses(["notice"])
24

35
filegroup(

third_party/py/concurrent/BUILD

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
load("@io_bazel//tools/python:private/defs.bzl", "py_library")
2+
13
licenses(["notice"])
24

35
filegroup(

third_party/py/gflags/BUILD

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
load("@io_bazel//tools/python:private/defs.bzl", "py_library")
2+
13
licenses(["notice"])
24

35
filegroup(

third_party/py/mock/BUILD

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
load("@io_bazel//tools/python:private/defs.bzl", "py_library")
2+
13
licenses(["notice"])
24

35
filegroup(

third_party/py/six/BUILD

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
load("@io_bazel//tools/python:private/defs.bzl", "py_library")
2+
13
licenses(["notice"])
24

35
filegroup(

0 commit comments

Comments
 (0)