Gabe Black has submitted this change and it was merged. (
https://gem5-review.googlesource.com/5004 )
Change subject: misc: When building packet_pb2.py, don't assume a
particular CWD.
......................................................................
misc: When building packet_pb2.py, don't assume a particular CWD.
Allow the script to be run from anywhere, and compute the paths relative to
where the script is. The script is assumed to be in util.
Change-Id: I8500ef959f2ff8119540c956f2b27789c96de60e
Reviewed-on: https://gem5-review.googlesource.com/5004
Reviewed-by: Andreas Sandberg <andreas.sandb...@arm.com>
Maintainer: Andreas Sandberg <andreas.sandb...@arm.com>
---
M util/decode_packet_trace.py
1 file changed, 7 insertions(+), 4 deletions(-)
Approvals:
Andreas Sandberg: Looks good to me, approved; Looks good to me, approved
diff --git a/util/decode_packet_trace.py b/util/decode_packet_trace.py
index c21a150..dab43c3 100755
--- a/util/decode_packet_trace.py
+++ b/util/decode_packet_trace.py
@@ -52,15 +52,18 @@
import sys
# Import the packet proto definitions. If they are not found, attempt
-# to generate them automatically. This assumes that the script is
-# executed from the gem5 root.
+# to generate them automatically.
try:
import packet_pb2
except:
print "Did not find packet proto definitions, attempting to generate"
+ import os
+ util_dir = os.path.dirname(os.path.realpath(__file__))
+ proto_dir = os.path.join(os.path.dirname(util_dir), 'src', 'proto')
+ proto_file = os.path.join(proto_dir, 'packet.proto')
from subprocess import call
- error = call(['protoc', '--python_out=util', '--proto_path=src/proto',
- 'src/proto/packet.proto'])
+ error = call(['protoc', '--python_out=' + util_dir,
+ '--proto_path=' + proto_dir, proto_file])
if not error:
print "Generated packet proto definitions"
--
To view, visit https://gem5-review.googlesource.com/5004
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I8500ef959f2ff8119540c956f2b27789c96de60e
Gerrit-Change-Number: 5004
Gerrit-PatchSet: 3
Gerrit-Owner: Gabe Black <gabebl...@google.com>
Gerrit-Reviewer: Andreas Hansson <andreas.hans...@arm.com>
Gerrit-Reviewer: Andreas Sandberg <andreas.sandb...@arm.com>
Gerrit-Reviewer: Gabe Black <gabebl...@google.com>
Gerrit-Reviewer: Jason Lowe-Power <ja...@lowepower.com>
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev