|  | @@ -22,7 +22,6 @@ load(
 | 
	
		
			
				|  |  |      "protobuf",
 | 
	
		
			
				|  |  |      "cc_proto_library",
 | 
	
		
			
				|  |  |      "py_proto_library",
 | 
	
		
			
				|  |  | -    "internal_copied_filegroup",
 | 
	
		
			
				|  |  |      "internal_protobuf_py_tests",
 | 
	
		
			
				|  |  |  )
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -484,25 +483,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(
 | 
	
		
			
				|  |  |          [
 | 
	
	
		
			
				|  | @@ -514,7 +495,7 @@ internal_copied_filegroup(
 | 
	
		
			
				|  |  |              "python/google/protobuf/internal/test_util.py",
 | 
	
		
			
				|  |  |          ],
 | 
	
		
			
				|  |  |      ),
 | 
	
		
			
				|  |  | -    include = "python",
 | 
	
		
			
				|  |  | +    imports = ["python"],
 | 
	
		
			
				|  |  |  )
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  cc_binary(
 | 
	
	
		
			
				|  | @@ -527,7 +508,7 @@ cc_binary(
 | 
	
		
			
				|  |  |      linkstatic = 1,
 | 
	
		
			
				|  |  |      deps = select({
 | 
	
		
			
				|  |  |          "//conditions:default": [],
 | 
	
		
			
				|  |  | -        ":use_fast_cpp_protos": ["//util/python:python_headers"],
 | 
	
		
			
				|  |  | +        ":use_fast_cpp_protos": ["//external:python_headers"],
 | 
	
		
			
				|  |  |      }),
 | 
	
		
			
				|  |  |  )
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -553,7 +534,7 @@ cc_binary(
 | 
	
		
			
				|  |  |          ":protobuf",
 | 
	
		
			
				|  |  |      ] + select({
 | 
	
		
			
				|  |  |          "//conditions:default": [],
 | 
	
		
			
				|  |  | -        ":use_fast_cpp_protos": ["//util/python:python_headers"],
 | 
	
		
			
				|  |  | +        ":use_fast_cpp_protos": ["//external:python_headers"],
 | 
	
		
			
				|  |  |      }),
 | 
	
		
			
				|  |  |  )
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -584,23 +565,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,
 | 
	
	
		
			
				|  | @@ -624,7 +596,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",
 |