From 0f7b18fa0d353aab0a44082b1aca8d8c00df71a7 Mon Sep 17 00:00:00 2001 From: Mathieu Bridon Date: Thu, 5 Jul 2018 15:17:32 +0200 Subject: python: Use the print function In Python 2, `print` was a statement, but it became a function in Python 3. Using print functions everywhere makes the script compatible with Python versions >= 2.6, including Python 3. Signed-off-by: Mathieu Bridon Acked-by: Eric Engestrom Acked-by: Dylan Baker --- src/gallium/drivers/r600/egd_tables.py | 51 +++++++++++++++++----------------- 1 file changed, 26 insertions(+), 25 deletions(-) (limited to 'src/gallium/drivers/r600/egd_tables.py') diff --git a/src/gallium/drivers/r600/egd_tables.py b/src/gallium/drivers/r600/egd_tables.py index d7b78c7fb16..7489649ec72 100644 --- a/src/gallium/drivers/r600/egd_tables.py +++ b/src/gallium/drivers/r600/egd_tables.py @@ -1,3 +1,4 @@ +from __future__ import print_function CopyRight = ''' /* @@ -217,10 +218,10 @@ def write_tables(regs, packets): strings = StringTable() strings_offsets = IntTable("int") - print '/* This file is autogenerated by egd_tables.py from evergreend.h. Do not edit directly. */' - print - print CopyRight.strip() - print ''' + print('/* This file is autogenerated by egd_tables.py from evergreend.h. Do not edit directly. */') + print() + print(CopyRight.strip()) + print(''' #ifndef EG_TABLES_H #define EG_TABLES_H @@ -242,20 +243,20 @@ struct eg_packet3 { unsigned name_offset; unsigned op; }; -''' +''') - print 'static const struct eg_packet3 packet3_table[] = {' + print('static const struct eg_packet3 packet3_table[] = {') for pkt in packets: - print '\t{%s, %s},' % (strings.add(pkt[5:]), pkt) - print '};' - print + print('\t{%s, %s},' % (strings.add(pkt[5:]), pkt)) + print('};') + print() - print 'static const struct eg_field egd_fields_table[] = {' + print('static const struct eg_field egd_fields_table[] = {') fields_idx = 0 for reg in regs: if len(reg.fields) and reg.own_fields: - print '\t/* %s */' % (fields_idx) + print('\t/* %s */' % (fields_idx)) reg.fields_idx = fields_idx @@ -266,34 +267,34 @@ struct eg_packet3 { while value[1] >= len(values_offsets): values_offsets.append(-1) values_offsets[value[1]] = strings.add(strip_prefix(value[0])) - print '\t{%s, %s(~0u), %s, %s},' % ( + print('\t{%s, %s(~0u), %s, %s},' % ( strings.add(field.name), field.s_name, - len(values_offsets), strings_offsets.add(values_offsets)) + len(values_offsets), strings_offsets.add(values_offsets))) else: - print '\t{%s, %s(~0u)},' % (strings.add(field.name), field.s_name) + print('\t{%s, %s(~0u)},' % (strings.add(field.name), field.s_name)) fields_idx += 1 - print '};' - print + print('};') + print() - print 'static const struct eg_reg egd_reg_table[] = {' + print('static const struct eg_reg egd_reg_table[] = {') for reg in regs: if len(reg.fields): - print '\t{%s, %s, %s, %s},' % (strings.add(reg.name), reg.r_name, - len(reg.fields), reg.fields_idx if reg.own_fields else reg.fields_owner.fields_idx) + print('\t{%s, %s, %s, %s},' % (strings.add(reg.name), reg.r_name, + len(reg.fields), reg.fields_idx if reg.own_fields else reg.fields_owner.fields_idx)) else: - print '\t{%s, %s},' % (strings.add(reg.name), reg.r_name) - print '};' - print + print('\t{%s, %s},' % (strings.add(reg.name), reg.r_name)) + print('};') + print() strings.emit(sys.stdout, "egd_strings") - print + print() strings_offsets.emit(sys.stdout, "egd_strings_offsets") - print - print '#endif' + print() + print('#endif') def main(): -- cgit v1.2.3