summaryrefslogtreecommitdiff
path: root/util/encode_packet_trace.py
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2014-02-18 05:50:52 -0500
committerAndreas Hansson <andreas.hansson@arm.com>2014-02-18 05:50:52 -0500
commite83fdc532b8304610f8988d524c6773996f6f926 (patch)
tree00aa96451fa52ec242fca75cc16a82195212847c /util/encode_packet_trace.py
parentc9cb492e1c10ff15efcf87fa9cab1e74fceb7588 (diff)
downloadgem5-e83fdc532b8304610f8988d524c6773996f6f926.tar.xz
util: Enhance the error messages for packet encode/decode
This patch adds a more verbose error message when the Python protobuf module cannot be loaded.
Diffstat (limited to 'util/encode_packet_trace.py')
-rwxr-xr-xutil/encode_packet_trace.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/util/encode_packet_trace.py b/util/encode_packet_trace.py
index fc6ddf7fd..13057a13d 100755
--- a/util/encode_packet_trace.py
+++ b/util/encode_packet_trace.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-# Copyright (c) 2013 ARM Limited
+# Copyright (c) 2013-2014 ARM Limited
# All rights reserved
#
# The license below extends only to copyright in the software and shall
@@ -97,8 +97,15 @@ except:
error = call(['protoc', '--python_out=util', '--proto_path=src/proto',
'src/proto/packet.proto'])
if not error:
- import packet_pb2
print "Generated packet proto definitions"
+
+ try:
+ import google.protobuf
+ except:
+ print "Please install the Python protobuf module"
+ exit(-1)
+
+ import packet_pb2
else:
print "Failed to import packet proto definitions"
exit(-1)