mirror of
https://github.com/systemd/systemd
synced 2024-09-06 16:56:43 +00:00
![Zbigniew Jędrzejewski-Szmek](/assets/img/avatar_default.png)
Use f-strings and simplify the code a bit. When I call 'acpi-update.py' after those changes, the resulting .hwdb files are the same except for two additions that appeared in the meantime. I don't think it makes sense to update them again, because the ma-*.txt files changed and we don't want to store big blobs unnecessarilly.
27 lines
743 B
Python
Executable file
27 lines
743 B
Python
Executable file
#!/usr/bin/env python3
|
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
|
from csv import reader
|
|
|
|
# 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(f'\nacpi:{row[1].strip()}*:\n ID_VENDOR_FROM_DATABASE={row[0].strip()}')
|
|
|
|
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.csv')
|
|
read_table('pnp_id_registry.csv')
|