Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add load() statements for Python rules in third_party #9019

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions third_party/def_parser/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Needed for #9006. Consider replacing label with @rules_python as per #9029 if
# merging from upstream becomes an issue.
load("//tools/python:private/defs.bzl", "py_test")

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

package(
Expand Down
2 changes: 2 additions & 0 deletions third_party/protobuf/3.6.1/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ config_setting(

load(":protobuf.bzl", "py_proto_library")
load(":compiler_config_setting.bzl", "create_compiler_config_setting")
# Needed for #9006. Hopefully a future upstream version will include this line.
load("@rules_python//python:defs.bzl", "py_library")

filegroup(
name = "srcs",
Expand Down
7 changes: 5 additions & 2 deletions third_party/protobuf/3.6.1/protobuf.bzl
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Needed for #9006. Hopefully a future upstream version will include this line.
load("@rules_python//python: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 +386,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 +409,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
3 changes: 3 additions & 0 deletions third_party/protobuf/3.6.1/six.BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Needed for #9006. Hopefully a future upstream version will include this line.
load("@rules_python//python:defs.bzl", "py_library")

genrule(
name = "copy_six",
srcs = ["six-1.10.0/six.py"],
Expand Down
5 changes: 5 additions & 0 deletions third_party/protobuf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ You will create and merge the following Pull Requests.
copy the `licenses` declaration and the `srcs` filegroup to the corresponding file under
`third_party/protobuf/<new_proto>`.

1. Modify the new protobuf to be compatible with #9006 (until upstream protobuf migrates):
In the `BUILD`, `protobuf.bzl`, and `six.BUILD` files under `third_party/protobuf/<new_proto>`,
copy the line that loads from `@rules_python` along with its explanatory comment, from the
corresponding files in the old proto directory. (See also #9019.)

1. In `third_party/protobuf/<new_proto>/BUILD`, in the `srcs` filegroup rule, update the version
number referring to the newly added `srcs` rules.

Expand Down
4 changes: 4 additions & 0 deletions third_party/py/abseil/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Needed for #9006. Consider replacing label with @rules_python as per #9029 if
# merging from upstream becomes an issue.
load("//tools/python:private/defs.bzl", "py_library")

licenses(["notice"])

filegroup(
Expand Down
4 changes: 4 additions & 0 deletions third_party/py/concurrent/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Needed for #9006. Consider replacing label with @rules_python as per #9029 if
# merging from upstream becomes an issue.
load("//tools/python:private/defs.bzl", "py_library")

licenses(["notice"])

filegroup(
Expand Down
4 changes: 4 additions & 0 deletions third_party/py/gflags/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Needed for #9006. Consider replacing label with @rules_python as per #9029 if
# merging from upstream becomes an issue.
load("//tools/python:private/defs.bzl", "py_library")

licenses(["notice"])

filegroup(
Expand Down
4 changes: 4 additions & 0 deletions third_party/py/mock/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Needed for #9006. Consider replacing label with @rules_python as per #9029 if
# merging from upstream becomes an issue.
load("//tools/python:private/defs.bzl", "py_library")

licenses(["notice"])

filegroup(
Expand Down
5 changes: 5 additions & 0 deletions third_party/py/six/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Needed for #9006. We can't easily replace this label with a @rules_python
# label (#9029) because this file is used in both @io_bazel and @bazel_tools,
# the latter of which can't reference other repos.
load("//tools/python:private/defs.bzl", "py_library")

licenses(["notice"])

filegroup(
Expand Down