Fix perf results upload.

Starting from [1], //third_party/protobuf has been updated to 3.13.0
and this introduces a breaking change which breaks WebRTC's perf results
upload (see bugs.webrtc.org/12211).

Error:

File [..]/tracing/proto/histogram_proto.py", line 9, in <module>
    import histogram_pb2  # pylint:disable=relative-import
  File "[..]/tracing/proto/histogram_pb2.py", line 22, in <module>
    create_key=_descriptor._internal_create_key,
AttributeError: 'module' object has no attribute '_internal_create_key'

It looks like vpython is not able to load the wheel from the vpython
environment if the import happens in the "from ... import ..." form
while it works if the library is pre-imported with "import ...".

[1] - https://chromium-review.googlesource.com/c/chromium/src/+/2545204

No-Try: True
No-Presubmit: True
Bug: webrtc:12211
Change-Id: Id3e365eb9d4c4c31bcd4dcfab7db700e0e6e00b2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/195000
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Andrey Logvin <landrey@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32677}
This commit is contained in:
Mirko Bonadei
2020-11-23 17:45:52 +01:00
committed by Commit Bot
parent 19526a69c7
commit db9095de83
2 changed files with 14 additions and 0 deletions

9
DEPS
View File

@ -3167,6 +3167,15 @@ hooks = [
'--bucket', 'chromium-webrtc-resources',
'src/resources'],
},
# Download and initialize "vpython" VirtualEnv environment packages.
{
'name': 'vpython_common',
'pattern': '.',
'action': [ 'vpython',
'-vpython-spec', 'src/.vpython',
'-vpython-tool', 'install',
],
},
]
recursedeps = []

View File

@ -21,6 +21,11 @@ import argparse
import os
import sys
# Even if protobuf is not used directly, this allows transitive imports
# of the protobuf library to use the vpython wheel specified in the root
# level .vpython (see bugs.webrtc.org/12211 for context).
import google.protobuf # pylint: disable=unused-import
def _CreateParser():
parser = argparse.ArgumentParser()