changeset 58bf21ca88de in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=58bf21ca88de
description:
        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:

 util/decode_packet_trace.py |  11 +++++++++--
 util/encode_packet_trace.py |  11 +++++++++--
 2 files changed, 18 insertions(+), 4 deletions(-)

diffs (56 lines):

diff -r 0267a9b58c8e -r 58bf21ca88de util/decode_packet_trace.py
--- a/util/decode_packet_trace.py       Tue Feb 18 05:50:51 2014 -0500
+++ b/util/decode_packet_trace.py       Tue Feb 18 05:50:52 2014 -0500
@@ -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
@@ -92,8 +92,15 @@
     error = call(['protoc', '--python_out=util', '--proto_path=src/proto',
                   'src/proto/packet.proto'])
     if not error:
+        print "Generated packet proto definitions"
+
+        try:
+            import google.protobuf
+        except:
+            print "Please install Python protobuf module"
+            exit(-1)
+
         import packet_pb2
-        print "Generated packet proto definitions"
     else:
         print "Failed to import packet proto definitions"
         exit(-1)
diff -r 0267a9b58c8e -r 58bf21ca88de util/encode_packet_trace.py
--- a/util/encode_packet_trace.py       Tue Feb 18 05:50:51 2014 -0500
+++ b/util/encode_packet_trace.py       Tue Feb 18 05:50:52 2014 -0500
@@ -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 @@
     error = call(['protoc', '--python_out=util', '--proto_path=src/proto',
                   'src/proto/packet.proto'])
     if not error:
+        print "Generated packet proto definitions"
+
+        try:
+            import google.protobuf
+        except:
+            print "Please install the Python protobuf module"
+            exit(-1)
+
         import packet_pb2
-        print "Generated packet proto definitions"
     else:
         print "Failed to import packet proto definitions"
         exit(-1)
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to