From e07fcc4d492e9b87020cb01fad9f6e31d9fb1eab Mon Sep 17 00:00:00 2001 From: Carter Li Date: Thu, 26 Sep 2024 19:37:24 +0800 Subject: [PATCH] Scripts: fix old python version compatibility --- scripts/gen-pciids.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/gen-pciids.py b/scripts/gen-pciids.py index bc98fec55..20ffbaf58 100644 --- a/scripts/gen-pciids.py +++ b/scripts/gen-pciids.py @@ -55,17 +55,19 @@ typedef struct FFPciVendor for vendor in vendors: if vendor.devices: + piece = ',\n '.join('{{ 0x{:04X}, "{}" }}'.format(device.id, device.name.replace('"', '\\"')) for device in vendor.devices) code += f""" // {vendor.name} static const FFPciDevice pciDevices_{vendor.id:04X}[] = {{ - {',\n '.join(f'{{ 0x{device.id:04X}, "{device.name.replace('"', '\\"')}" }}' for device in vendor.devices)}, + {piece}, {{}}, }}; """ + piece = ',\n '.join('{{ 0x{:04X}, "{}", {}, {} }}'.format(vendor.id, vendor.name.replace('"', '\\"'), vendor.devices and f"pciDevices_{vendor.id:04X}" or "NULL", len(vendor.devices)) for vendor in vendors) code += f""" const FFPciVendor ffPciVendors[] = {{ - {',\n '.join(f'{{ 0x{vendor.id:04X}, "{vendor.name.replace('"', '\\"')}", {vendor.devices and f"pciDevices_{vendor.id:04X}" or "NULL"}, {len(vendor.devices)} }}' for vendor in vendors)}, + {piece}, {{}}, }};"""