PROTOBUF_SYNC_PIPER
pull/9836/head^2
Joshua Haberman 3 years ago
parent 9bd67b6aac
commit a27ce12d3a
  1. 5
      CHANGES.txt
  2. 6
      protobuf_deps.bzl
  3. 17
      python/google/protobuf/internal/api_implementation.py

@ -1,3 +1,8 @@
Unreleased Changes (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
Compiler
* Require package names to be less than 512 bytes in length
2022-04-05 version 3.20.1 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) 2022-04-05 version 3.20.1 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
PHP PHP

@ -88,10 +88,10 @@ def protobuf_deps():
http_archive( http_archive(
name = "rules_pkg", name = "rules_pkg",
urls = [ urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.5.1/rules_pkg-0.5.1.tar.gz", "https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.7.0/rules_pkg-0.7.0.tar.gz",
"https://github.com/bazelbuild/rules_pkg/releases/download/0.5.1/rules_pkg-0.5.1.tar.gz", "https://github.com/bazelbuild/rules_pkg/releases/download/0.7.0/rules_pkg-0.7.0.tar.gz",
], ],
sha256 = "a89e203d3cf264e564fcb96b6e06dd70bc0557356eb48400ce4b5d97c2c3720d", sha256 = "8a298e832762eda1830597d64fe7db58178aa84cd5926d76d5b744d6558941c2",
) )
if not native.existing_rule("io_bazel_rules_kotlin"): if not native.existing_rule("io_bazel_rules_kotlin"):

@ -59,11 +59,26 @@ except ImportError:
pass # Unspecified by compiler flags. pass # Unspecified by compiler flags.
def _CanImport(mod_name):
try:
mod = importlib.import_module(mod_name)
# Work around a known issue in the classic bootstrap .par import hook.
if not mod:
raise ImportError(mod_name + ' import succeeded but was None')
return True
except ImportError:
return False
if _implementation_type is None: if _implementation_type is None:
if _CanImport('google._upb._message'):
_implementation_type = 'upb'
elif _CanImport('google.protobuf.pyext._message'):
_implementation_type = 'cpp'
else:
_implementation_type = 'python' _implementation_type = 'python'
# This environment variable can be used to switch to a certain implementation # This environment variable can be used to switch to a certain implementation
# of the Python API, overriding the compile-time constants in the # of the Python API, overriding the compile-time constants in the
# _api_implementation module. Right now only 'python', 'cpp' and 'upb' are # _api_implementation module. Right now only 'python', 'cpp' and 'upb' are
@ -98,7 +113,7 @@ if _implementation_type == 'cpp':
if _implementation_type == 'upb': if _implementation_type == 'upb':
try: try:
# pylint: disable=g-import-not-at-top # pylint: disable=g-import-not-at-top
from google.protobuf.pyext import _upb_message as _message from google._upb import _message
_c_module = _message _c_module = _message
del _message del _message
except ImportError: except ImportError:

Loading…
Cancel
Save