Commit 5effab05 authored by Simon Glass's avatar Simon Glass
Browse files

rkmux: Convert to Python 3



Convert this tool to Python 3 and make it use that, to meet the 2020
deadline.
Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
parent 793dca34
#!/usr/bin/env python2 #!/usr/bin/env python3
# Script to create enums from datasheet register tables # Script to create enums from datasheet register tables
# #
...@@ -43,8 +43,8 @@ class RegField: ...@@ -43,8 +43,8 @@ class RegField:
self.desc.append(desc) self.desc.append(desc)
def Show(self): def Show(self):
print self print(self)
print print()
self.__init__() self.__init__()
def __str__(self): def __str__(self):
...@@ -65,11 +65,11 @@ class Printer: ...@@ -65,11 +65,11 @@ class Printer:
self.output_footer() self.output_footer()
def output_header(self): def output_header(self):
print '/* %s */' % self.name print('/* %s */' % self.name)
print 'enum {' print('enum {')
def output_footer(self): def output_footer(self):
print '};'; print('};');
def output_regfield(self, regfield): def output_regfield(self, regfield):
lines = regfield.desc lines = regfield.desc
...@@ -97,7 +97,7 @@ class Printer: ...@@ -97,7 +97,7 @@ class Printer:
self.first = False self.first = False
self.output_header() self.output_header()
else: else:
print print()
out_enum(field, 'shift', bit_low) out_enum(field, 'shift', bit_low)
out_enum(field, 'mask', mask) out_enum(field, 'mask', mask)
next_val = -1 next_val = -1
...@@ -175,7 +175,7 @@ def out_enum(field, suffix, value, skip_val=False): ...@@ -175,7 +175,7 @@ def out_enum(field, suffix, value, skip_val=False):
val_str = '%d' % value val_str = '%d' % value
str += '%s= %s' % ('\t' * tabs, val_str) str += '%s= %s' % ('\t' * tabs, val_str)
print '\t%s,' % str print('\t%s,' % str)
# Process a CSV file, e.g. from tabula # Process a CSV file, e.g. from tabula
def process_csv(name, fd): def process_csv(name, fd):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment