File: acpi-update.py

package info (click to toggle)
systemd 259.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 113,388 kB
  • sloc: ansic: 727,211; xml: 121,125; python: 36,732; sh: 34,990; cpp: 946; makefile: 278; awk: 102; lisp: 13; sed: 1
file content (26 lines) | stat: -rwxr-xr-x 743 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/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')