aboutsummaryrefslogtreecommitdiffhomepage
path: root/BUILD
diff options
context:
space:
mode:
authorGravatar Pete Warden <pete@petewarden.com>2016-03-09 13:05:15 -0800
committerGravatar Pete Warden <pete@petewarden.com>2016-03-09 13:05:15 -0800
commitbc2d6c2504b38dda4345e9960948d96102daccc3 (patch)
tree48ad357a166b3bf9715a20714db8c117d8150c41 /BUILD
parentf0c1a8637218a03a083901493c9b3acdb6e5db57 (diff)
parent48ebb29a8ec118bf6b9ee39f6be42b57321c099a (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'BUILD')
-rw-r--r--BUILD52
1 files changed, 15 insertions, 37 deletions
diff --git a/BUILD b/BUILD
index 39ba0d94..b1eda4d4 100644
--- a/BUILD
+++ b/BUILD
@@ -22,7 +22,6 @@ load(
"protobuf",
"cc_proto_library",
"py_proto_library",
- "internal_copied_filegroup",
"internal_protobuf_py_tests",
)
@@ -525,25 +524,7 @@ java_library(
# Python support
################################################################################
-# Hack:
-# protoc generated files contain imports like:
-# "from google.protobuf.xxx import yyy"
-# However, the sources files of the python runtime are not directly under
-# "google/protobuf" (they are under python/google/protobuf). We workaround
-# this by copying runtime source files into the desired location to workaround
-# the import issue. Ideally py_library should support something similiar to the
-# "include" attribute in cc_library to inject the PYTHON_PATH for all libraries
-# that depend on the target.
-#
-# If you use python protobuf as a third_party library in your bazel managed
-# project:
-# 1) Please import the whole package to //google/protobuf in your
-# project. Otherwise, bazel disallows generated files out of the current
-# package, thus we won't be able to copy protobuf runtime files into
-# //google/protobuf/.
-# 2) The runtime also requires "six" for Python2/3 compatibility, please see the
-# WORKSPACE file and bind "six" to your workspace as well.
-internal_copied_filegroup(
+py_library(
name = "python_srcs",
srcs = glob(
[
@@ -555,7 +536,7 @@ internal_copied_filegroup(
"python/google/protobuf/internal/test_util.py",
],
),
- include = "python",
+ imports = ["python"],
)
cc_binary(
@@ -568,7 +549,7 @@ cc_binary(
linkstatic = 1,
deps = select({
"//conditions:default": [],
- ":use_fast_cpp_protos": ["//util/python:python_headers"],
+ ":use_fast_cpp_protos": ["//external:python_headers"],
}),
)
@@ -594,7 +575,7 @@ cc_binary(
":protobuf",
] + select({
"//conditions:default": [],
- ":use_fast_cpp_protos": ["//util/python:python_headers"],
+ ":use_fast_cpp_protos": ["//external:python_headers"],
}),
)
@@ -625,23 +606,14 @@ py_proto_library(
}),
default_runtime = "",
protoc = ":protoc",
- py_extra_srcs = [":python_srcs"],
- py_libs = ["//external:six"],
+ py_libs = [
+ ":python_srcs",
+ "//external:six"
+ ],
srcs_version = "PY2AND3",
visibility = ["//visibility:public"],
)
-internal_copied_filegroup(
- name = "python_test_srcs",
- srcs = glob(
- [
- "python/google/protobuf/internal/*_test.py",
- "python/google/protobuf/internal/test_util.py",
- ],
- ),
- include = "python",
-)
-
py_proto_library(
name = "python_common_test_protos",
srcs = LITE_TEST_PROTOS + TEST_PROTOS,
@@ -665,7 +637,13 @@ py_proto_library(
py_library(
name = "python_tests",
- srcs = [":python_test_srcs"],
+ srcs = glob(
+ [
+ "python/google/protobuf/internal/*_test.py",
+ "python/google/protobuf/internal/test_util.py",
+ ],
+ ),
+ imports = ["python"],
srcs_version = "PY2AND3",
deps = [
":protobuf_python",