diff --git a/hwdb.d/acpi-update.py b/hwdb.d/acpi-update.py index f65147c91d..41670b32bb 100755 --- a/hwdb.d/acpi-update.py +++ b/hwdb.d/acpi-update.py @@ -2,31 +2,25 @@ # SPDX-License-Identifier: LGPL-2.1-or-later from csv import reader -from enum import Enum -def read_table(a): - - table = [] - - with open(a, newline='') as csvfile: - for row in reader(csvfile): - if row[0] == "Company": - # Skip header - continue - table.append(row) +# pylint: disable=consider-using-with +def read_table(filename): + table = list(reader(open(filename, newline=''))) + table = table[1:] # Skip header table.sort(key=lambda x: x[1]) for row in table: # Some IDs end with whitespace, while they didn't in the old HTML table, so it's probably # a mistake, strip it. - print("\nacpi:{0}*:\n ID_VENDOR_FROM_DATABASE={1}".format(row[1].strip(), row[0].strip())) + print(f'\nacpi:{row[1].strip()}*:\n ID_VENDOR_FROM_DATABASE={row[0].strip()}') -print('# This file is part of systemd.\n' - '#\n' - '# Data imported from:\n' - '# https://uefi.org/uefi-pnp-export\n' - '# https://uefi.org/uefi-acpi-export') +print('''\ +# This file is part of systemd. +# +# Data imported from: +# https://uefi.org/uefi-pnp-export +# https://uefi.org/uefi-acpi-export''') -read_table("acpi_id_registry.html") -read_table("pnp_id_registry.html") +read_table('acpi_id_registry.csv') +read_table('pnp_id_registry.csv') diff --git a/hwdb.d/acpi_id_registry.html b/hwdb.d/acpi_id_registry.csv similarity index 100% rename from hwdb.d/acpi_id_registry.html rename to hwdb.d/acpi_id_registry.csv diff --git a/hwdb.d/pnp_id_registry.html b/hwdb.d/pnp_id_registry.csv similarity index 100% rename from hwdb.d/pnp_id_registry.html rename to hwdb.d/pnp_id_registry.csv diff --git a/test/fuzz/meson.build b/test/fuzz/meson.build index b6bcb52551..54cbb75532 100644 --- a/test/fuzz/meson.build +++ b/test/fuzz/meson.build @@ -46,11 +46,7 @@ else endif fuzz_c_args = get_option('c_args') -if cxx_cmd != '' - fuzz_cpp_args = get_option('cpp_args') -else - fuzz_cpp_args = [] -endif +fuzz_cpp_args = cxx_cmd != '' ? get_option('cpp_args') : [] sanitize_address_undefined = custom_target( 'sanitize-address-undefined-fuzzers', diff --git a/tools/update-hwdb.sh b/tools/update-hwdb.sh index abbbb82f4b..096a10016b 100755 --- a/tools/update-hwdb.sh +++ b/tools/update-hwdb.sh @@ -21,8 +21,8 @@ if [ "${2:-}" != "-n" ]; then ( curl --fail -L -o ma-large.txt 'http://standards-oui.ieee.org/oui/oui.txt' curl --fail -L -o ma-medium.txt 'http://standards-oui.ieee.org/oui28/mam.txt' curl --fail -L -o ma-small.txt 'http://standards-oui.ieee.org/oui36/oui36.txt' - curl --fail -L -o pnp_id_registry.html 'https://uefi.org/uefi-pnp-export' - curl --fail -L -o acpi_id_registry.html 'https://uefi.org/uefi-acpi-export' + curl --fail -L -o pnp_id_registry.csv 'https://uefi.org/uefi-pnp-export' + curl --fail -L -o acpi_id_registry.csv 'https://uefi.org/uefi-acpi-export' ) fi set -x