protobuf.patch 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. --- BUILD
  2. +++ BUILD
  3. @@ -525,7 +525,7 @@ cc_binary(
  4. filegroup(
  5. name = "testdata",
  6. srcs = glob(["src/google/protobuf/testdata/**/*"]),
  7. - visibility = ["//:__subpackages__"],
  8. + visibility = ["//visibility:public"],
  9. )
  10. RELATIVE_LITE_TEST_PROTOS = [
  11. @@ -931,13 +931,10 @@ py_library(
  12. [
  13. "python/google/protobuf/**/*.py",
  14. ],
  15. - exclude = [
  16. - "python/google/protobuf/internal/*_test.py",
  17. - "python/google/protobuf/internal/test_util.py",
  18. - ],
  19. ),
  20. imports = ["python"],
  21. srcs_version = "PY2AND3",
  22. + visibility = ["//visibility:public"],
  23. )
  24. cc_binary(
  25. @@ -1038,13 +1035,6 @@ py_proto_library(
  26. name = "protobuf_python",
  27. srcs = COPIED_WELL_KNOWN_PROTOS,
  28. include = "python",
  29. - data = select({
  30. - "//conditions:default": [],
  31. - ":use_fast_cpp_protos": [
  32. - ":python/google/protobuf/internal/_api_implementation.so",
  33. - ":python/google/protobuf/pyext/_message.so",
  34. - ],
  35. - }),
  36. default_runtime = "",
  37. protoc = ":protoc",
  38. py_libs = [
  39. @@ -1080,6 +1070,7 @@ py_proto_library(
  40. protoc = ":protoc",
  41. srcs_version = "PY2AND3",
  42. deps = [":protobuf_python"],
  43. + visibility = ["//visibility:public"],
  44. )
  45. py_proto_library(
  46. @@ -1093,6 +1084,7 @@ py_proto_library(
  47. protoc = ":protoc",
  48. srcs_version = "PY2AND3",
  49. deps = [":python_common_test_protos"],
  50. + visibility = ["//visibility:public"],
  51. )
  52. py_library(
  53. --- python/google/protobuf/internal/test_util.py
  54. +++ python/google/protobuf/internal/test_util.py
  55. @@ -634,6 +634,13 @@ def GoldenFile(filename):
  56. # Found it. Load the golden file from the testdata directory.
  57. return open(full_path, 'rb')
  58. + # Search for cross-repo path.
  59. + full_path = os.path.join('external/com_google_protobuf/src/google/protobuf/testdata',
  60. + filename)
  61. + if os.path.exists(full_path):
  62. + # Found it. Load the golden file from the testdata directory.
  63. + return open(full_path, 'rb')
  64. +
  65. raise RuntimeError(
  66. 'Could not find golden files. This test must be run from within the '
  67. 'protobuf source package so that it can read test data files from the '
  68. --- python/google/protobuf/internal/testing_refleaks.py
  69. +++ python/google/protobuf/internal/testing_refleaks.py
  70. @@ -67,6 +67,12 @@ class ReferenceLeakCheckerMixin(object):
  71. NB_RUNS = 3
  72. def run(self, result=None):
  73. + testMethod = getattr(self, self._testMethodName)
  74. + expecting_failure_method = getattr(testMethod, "__unittest_expecting_failure__", False)
  75. + expecting_failure_class = getattr(self, "__unittest_expecting_failure__", False)
  76. + if expecting_failure_class or expecting_failure_method:
  77. + return
  78. +
  79. # python_message.py registers all Message classes to some pickle global
  80. # registry, which makes the classes immortal.
  81. # We save a copy of this registry, and reset it before we could references.