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}
diff --git a/DEPS b/DEPS
index 6b00452..d29ef8e 100644
--- a/DEPS
+++ b/DEPS
@@ -3167,6 +3167,15 @@
'--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 = []
diff --git a/tools_webrtc/perf/webrtc_dashboard_upload.py b/tools_webrtc/perf/webrtc_dashboard_upload.py
index df5b9bb..a709af5 100644
--- a/tools_webrtc/perf/webrtc_dashboard_upload.py
+++ b/tools_webrtc/perf/webrtc_dashboard_upload.py
@@ -21,6 +21,11 @@
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()