Update tools to python3 (#85)
This updates the scripts in the tools directory to work with python3, python2
support is now deprecated.
The only significant API change is that the subprocess module works in bytes
instead of str, the rest are mainly style changes.
diff --git a/tools/generate_simulator_traces.py b/tools/generate_simulator_traces.py
index 3e25b0d..66c49c3 100755
--- a/tools/generate_simulator_traces.py
+++ b/tools/generate_simulator_traces.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2.7
+#!/usr/bin/env python3
# Copyright 2015, VIXL authors
# All rights reserved.
@@ -155,7 +155,7 @@
master_trace_f.write('\n\n')
# Find the AArch64 simulator tests.
- tests = sorted(filter(lambda t: 'AARCH64_SIM_' in t, test_list.split()),
+ tests = sorted([t for t in test_list.split() if 'AARCH64_SIM_' in t],
key=lambda t: GetAArch64Filename(t))
for test in tests:
@@ -164,7 +164,7 @@
trace_filename = GetAArch64Filename(test_name)
if not args.filter or re.compile(args.filter).search(test):
# Run each test.
- print 'Generating trace for ' + test;
+ print('Generating trace for ' + test);
cmd = ' '.join([args.runner, '--generate_test_trace', test])
status, output = util.getstatusoutput(cmd)
if status != 0: util.abort('Failed to run ' + cmd + '.')
@@ -207,7 +207,7 @@
for test in tests:
# Run each test.
- print 'Generating trace for ' + test;
+ print('Generating trace for ' + test);
# Strip out 'AARCH32_' to get the name of the test.
test_name = test[len('AARCH32_'):]
@@ -234,4 +234,4 @@
'\n' + "#endif // VIXL_" + test_name.upper() + "_H_" + '\n')
trace_f.close()
- print 'Trace generation COMPLETE'
+ print('Trace generation COMPLETE')