File: make-udev-rules.py

package info (click to toggle)
xr-hardware 1.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 220 kB
  • sloc: python: 244; makefile: 40
file content (21 lines) | stat: -rwxr-xr-x 702 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env python3
# Copyright 2019-2022, Collabora, Ltd.
# SPDX-License-Identifier: BSL-1.0
#
# Original Author: Rylie Pavlik <rylie.pavlik@collabora.com>
"""Make a standalone .rules file."""
from xrhardware.db import get_devices
from xrhardware.generate import generate_rules_file_contents

if __name__ == "__main__":
    all_rules = "\n\n".join(d.make_commented_rule() for d in get_devices())
    contents = "\n".join(
        (
            "# BEGIN DEVICE LIST #",
            "#####################",
            all_rules,
            "###################",
            "# END DEVICE LIST #",
        )
    )
    print(generate_rules_file_contents(__file__, "70-xrhardware.rules", contents))