Skip to content

Commit

Permalink
Add load() statements for Python rules in third_party
Browse files Browse the repository at this point in the history
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
  • Loading branch information
brandjon committed Jul 30, 2019
1 parent a2732d8 commit 63c7e99
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 2 deletions.
2 changes: 2 additions & 0 deletions third_party/def_parser/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("//tools/python:private/defs.bzl", "py_test")

licenses(["notice"]) # 3-clause BSD

package(
Expand Down
1 change: 1 addition & 0 deletions third_party/protobuf/3.6.1/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ config_setting(

load(":protobuf.bzl", "py_proto_library")
load(":compiler_config_setting.bzl", "create_compiler_config_setting")
load("//tools/python:private/defs.bzl", "py_library")

filegroup(
name = "srcs",
Expand Down
6 changes: 4 additions & 2 deletions third_party/protobuf/3.6.1/protobuf.bzl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("//tools/python:private/defs.bzl", "py_library", "py_test")

def _GetPath(ctx, path):
if ctx.label.workspace_root:
return ctx.label.workspace_root + "/" + path
Expand Down Expand Up @@ -383,7 +385,7 @@ def py_proto_library(
if default_runtime and not default_runtime in py_libs + deps:
py_libs = py_libs + [default_runtime]

native.py_library(
py_library(
name = name,
srcs = outs + py_extra_srcs,
deps = py_libs + deps,
Expand All @@ -406,7 +408,7 @@ def internal_protobuf_py_tests(
"""
for m in modules:
s = "python/google/protobuf/internal/%s.py" % m
native.py_test(
py_test(
name = "py_%s" % m,
srcs = [s],
main = s,
Expand Down
2 changes: 2 additions & 0 deletions third_party/protobuf/3.6.1/six.BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("//tools/python:private/defs.bzl", "py_library")

genrule(
name = "copy_six",
srcs = ["six-1.10.0/six.py"],
Expand Down
2 changes: 2 additions & 0 deletions third_party/py/abseil/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("//tools/python:private/defs.bzl", "py_library")

licenses(["notice"])

filegroup(
Expand Down
2 changes: 2 additions & 0 deletions third_party/py/concurrent/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("//tools/python:private/defs.bzl", "py_library")

licenses(["notice"])

filegroup(
Expand Down
2 changes: 2 additions & 0 deletions third_party/py/gflags/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("//tools/python:private/defs.bzl", "py_library")

licenses(["notice"])

filegroup(
Expand Down
2 changes: 2 additions & 0 deletions third_party/py/mock/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("//tools/python:private/defs.bzl", "py_library")

licenses(["notice"])

filegroup(
Expand Down
2 changes: 2 additions & 0 deletions third_party/py/six/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("//tools/python:private/defs.bzl", "py_library")

licenses(["notice"])

filegroup(
Expand Down

0 comments on commit 63c7e99

Please sign in to comment.