File: check_configs.py

package info (click to toggle)
lirc 0.10.2-0.10
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,268 kB
  • sloc: ansic: 26,981; cpp: 9,187; sh: 5,875; python: 4,507; makefile: 1,049; xml: 63
file content (34 lines) | stat: -rwxr-xr-x 920 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
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python3

''' Simple lirc config files sanity tool. '''

import glob
import yaml
try:
    from yaml import CLoader as Loader, CDumper as Dumper
except ImportError:
    from yaml import Loader, Dumper

def main():
    configs = {}
    for path in glob.glob('*.conf'):
        with open(path) as f:
            cf = yaml.load(f.read(), Loader = Loader)
        if cf['config']['id'] + '.conf' != path:
            print( "Id: %s, path: %s" % (cf['config']['id'], path))
        configs[cf['config']['id']] = cf['config']
    for config in configs:
        if 'supports' in config:
            if config['supports'] == 'lirccode':
                if not 'lircd_conf' in config:
                    print('bad config:' + config['id'])
    for l in configs.keys():
        if not 'menu' in configs[l]:
            print("No menu: " + l)


if __name__ == '__main__':
    main()


# vim: set expandtab ts=4 sw=4: