aboutsummaryrefslogtreecommitdiffstats
path: root/fpga/usrp3/tools/scripts/viv_ip_xci_editor.py
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2020-12-01 18:50:12 +0100
committerWade Fife <wade.fife@ettus.com>2021-01-04 13:28:36 -0600
commitca68195b5d12c5410cfac8d459a0b0902c4c72c7 (patch)
treed50d2bd7541000fa0a0470c4f1f4610c93d3b410 /fpga/usrp3/tools/scripts/viv_ip_xci_editor.py
parent3b9ced8f07c068faf1f494ce170cb44edaa47075 (diff)
downloaduhd-ca68195b5d12c5410cfac8d459a0b0902c4c72c7.tar.gz
uhd-ca68195b5d12c5410cfac8d459a0b0902c4c72c7.tar.bz2
uhd-ca68195b5d12c5410cfac8d459a0b0902c4c72c7.zip
fpga: Remove Python2 support from build system
- 2to3 was used to convert the Python scripts, except where the tool choked and manual intervention was required - All references to "python" where replaced with "python3" - buffer() was replaced by memoryview()
Diffstat (limited to 'fpga/usrp3/tools/scripts/viv_ip_xci_editor.py')
-rw-r--r--fpga/usrp3/tools/scripts/viv_ip_xci_editor.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/fpga/usrp3/tools/scripts/viv_ip_xci_editor.py b/fpga/usrp3/tools/scripts/viv_ip_xci_editor.py
index 1f5ddf2c5..b749b76da 100644
--- a/fpga/usrp3/tools/scripts/viv_ip_xci_editor.py
+++ b/fpga/usrp3/tools/scripts/viv_ip_xci_editor.py
@@ -1,7 +1,8 @@
-#!/usr/bin/python
+#!/usr/bin/env python3
import argparse
-import os, sys
+import os
+import sys
import re
# Parse command line options
@@ -20,7 +21,7 @@ def get_options():
print('ERROR: Please specify the location for the XCI file to operate on\n')
parser.print_help()
sys.exit(1)
- if (not os.path.isfile(args.xci_filepath)):
+ if not os.path.isfile(args.xci_filepath):
print('ERROR: XCI File ' + args.xci_filepath + ' could not be accessed or is not a file.\n')
parser.print_help()
sys.exit(1)
@@ -59,7 +60,7 @@ def main():
print(xci_info['DEVICE'] + xci_info['PACKAGE'] + xci_info['SPEEDGRADE'])
elif args.action == 'retarget':
# Write a new XCI file with modified target info
- if (not os.path.isdir(args.output_dir)):
+ if not os.path.isdir(args.output_dir):
print('ERROR: IP Build directory ' + args.output_dir + ' could not be accessed or is not a directory.')
sys.exit(1)
if not args.target:
@@ -76,16 +77,16 @@ def main():
replace_dict['TEMPERATURE_GRADE'] = target_tok[4]
if len(target_tok) > 5:
replace_dict['SILICON_REVISION'] = target_tok[5]
- out_xci_filename = os.path.join(os.path.abspath(args.output_dir), os.path.basename(args.xci_filepath))
+ out_xci_filename = os.path.join(os.path.abspath(args.output_dir), os.path.basename(args.xci_filepath))
with open(out_xci_filename, 'w') as out_file:
for r_line in xci_lines:
w_line = r_line
- m = re.search(get_match_str('(' + '|'.join(replace_dict.keys()) + ')'), r_line)
+ m = re.search(get_match_str('(' + '|'.join(list(replace_dict.keys())) + ')'), r_line)
if m is not None:
w_line = m.group(1) + replace_dict[m.group(2)] + m.group(4) +'\n'
else:
- m = re.search(get_empty_match_str('(' + '|'.join(replace_dict.keys()) + ')'), r_line)
+ m = re.search(get_empty_match_str('(' + '|'.join(list(replace_dict.keys())) + ')'), r_line)
if m is not None:
w_line = m.group(1) + '>' + replace_dict[m.group(2)] + '</spirit:configurableElementValue>\n'
out_file.write(w_line)