Don't double import protobuf code.
The proto code is copied into the out dir, so always use that since it is what isolate is using. Previously we pointed straight at the checkout code. I think copying python into the out dir is probably the right way to do things, so we should go that way in the future. Bug: chromium:1029452 Change-Id: I701cc84a674021d2f78c73db8808f55cd6ae5174 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/171877 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Patrik Höglund <phoglund@webrtc.org> Cr-Commit-Position: refs/heads/master@{#30923}
This commit is contained in:
parent
8ab3c77c01
commit
a298fd54c1
@ -221,10 +221,10 @@ def _ConfigurePythonPath(args):
|
||||
checkout_root = os.path.abspath(
|
||||
os.path.join(script_dir, os.pardir, os.pardir))
|
||||
|
||||
# TODO(https://crbug.com/1029452): Use a copy rule and add these from the out
|
||||
# dir like for the third_party/protobuf code.
|
||||
sys.path.insert(0, os.path.join(checkout_root, 'third_party', 'catapult',
|
||||
'tracing'))
|
||||
sys.path.insert(0, os.path.join(checkout_root, 'third_party', 'protobuf',
|
||||
'python'))
|
||||
|
||||
# The low_bandwidth_audio_perf_test gn rule will build the protobuf stub for
|
||||
# python, so put it in the path for this script before we attempt to import
|
||||
@ -232,16 +232,15 @@ def _ConfigurePythonPath(args):
|
||||
histogram_proto_path = os.path.join(
|
||||
os.path.abspath(args.build_dir), 'pyproto', 'tracing', 'tracing', 'proto')
|
||||
sys.path.insert(0, histogram_proto_path)
|
||||
google_protobuf_path = os.path.join(
|
||||
os.path.abspath(args.build_dir), 'pyproto')
|
||||
sys.path.insert(0, google_protobuf_path)
|
||||
proto_stub_path = os.path.join(os.path.abspath(args.build_dir), 'pyproto')
|
||||
sys.path.insert(0, proto_stub_path)
|
||||
|
||||
# Fail early in case the proto hasn't been built.
|
||||
try:
|
||||
import histogram_pb2
|
||||
except ImportError as e:
|
||||
logging.exception(e)
|
||||
raise ImportError('Could not find histogram_pb2. You need to build the '
|
||||
raise ImportError('Could not import histogram_pb2. You need to build the '
|
||||
'low_bandwidth_audio_perf_test target before invoking '
|
||||
'this script. Expected to find '
|
||||
'histogram_pb2.py in %s.' % histogram_proto_path)
|
||||
|
||||
@ -106,11 +106,14 @@ std::string GetPerfResults();
|
||||
void PrintPlottableResults(const std::vector<std::string>& desired_graphs);
|
||||
|
||||
// Call GetPerfResults() and write its output to a file. Returns false if we
|
||||
// failed to write to the file.
|
||||
// failed to write to the file. If you want to print the proto in human readable
|
||||
// format, use tracing/bin/proto2json from third_party/catapult in your WebRTC
|
||||
// checkout.
|
||||
bool WritePerfResults(const std::string& output_path);
|
||||
|
||||
// By default, perf results are printed to stdout. Set the FILE* to where they
|
||||
// should be printing instead.
|
||||
// By default, human-readable perf results are printed to stdout. Set the FILE*
|
||||
// to where they should be printing instead. These results are not used to
|
||||
// upload to the dashboard, however - this is only through WritePerfResults.
|
||||
void SetPerfResultsOutput(FILE* output);
|
||||
|
||||
// Only for use by tests.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user