File: lirc-init-db

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 (32 lines) | stat: -rwxr-xr-x 1,019 bytes parent folder | download | duplicates (4)
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
#!/usr/bin/env python3
#
#  Create configs/driver.yaml using lirc-lsplugins and
#  configs/confs_by_driver using irdb-get. Runs as part of the
#  build unless cross-compiling in which case it needs to be
#  run manually after installation

import sys
import os
import subprocess

here = os.path.dirname(os.path.realpath(__file__))
if os.path.exists(os.path.join(here, '..', 'lirc_options.conf')):
    # building
    tooldir = here
    configs = os.path.join('..', 'configs')
else:
    sys.path.insert(0, here);
    import config
    tooldir = BINDIR
    configs = os.path.join(DATADIR, 'lirc', 'configs')

cmd = [os.path.join(here, 'lirc-lsplugins'),
       '-U', '../plugins/.libs', '--yaml']
data = subprocess.check_output(cmd)
with open(os.path.join(configs, 'drivers.yaml'), 'w') as f:
    f.write(data.decode('utf8̈́'))

cmd = [os.path.join(here, 'irdb-get'), 'yaml-config']
data = subprocess.check_output(cmd)
with open(os.path.join(configs, 'confs_by_driver.yaml'), 'w') as f:
    f.write(data.decode('utf8̈́'))