1 From bb6a390633f32942ac10f9b7b7fc01dfbd395a48 Mon Sep 17 00:00:00 2001
2 From: Alec Leamas <leamas.alec@nowhere.net>
3 Date: Fri, 21 Jan 2022 14:00:54 +0100
4 Subject: [PATCH] database.py: Handle new PyYAML interface.
7 python-pkg/lirc/database.py | 12 ++++++++----
8 tools/check_configs.py | 4 ++++
9 2 files changed, 12 insertions(+), 4 deletions(-)
11 diff --git a/python-pkg/lirc/database.py b/python-pkg/lirc/database.py
12 index d464c2ab..d1f42c64 100644
13 --- a/python-pkg/lirc/database.py
14 +++ b/python-pkg/lirc/database.py
15 @@ -44,6 +44,10 @@ import sys
20 + from yaml import CLoader as Loader, CDumper as Dumper
22 + from yaml import Loader, Dumper
25 "Cannot import the yaml library. Please install the python3
26 @@ -66,7 +70,7 @@ def _load_kerneldrivers(configdir):
29 with open(os.path.join(configdir, "kernel-drivers.yaml")) as f:
30 - cf = yaml.load(f.read())
31 + cf = yaml.load(f.read(), Loader = Loader)
32 drivers = cf['drivers'].copy()
33 for driver in cf['drivers']:
34 if driver == 'default':
35 @@ -132,14 +136,14 @@ class Database(object):
38 with open(os.path.join(yamlpath, "confs_by_driver.yaml")) as f:
39 - cf = yaml.load(f.read())
40 + cf = yaml.load(f.read(), Loader = Loader)
41 db['lircd_by_driver'] = cf['lircd_by_driver'].copy()
42 db['lircmd_by_driver'] = cf['lircmd_by_driver'].copy()
44 db['kernel-drivers'] = _load_kerneldrivers(configdir)
45 db['drivers'] = db['kernel-drivers'].copy()
46 with open(os.path.join(yamlpath, "drivers.yaml")) as f:
47 - cf = yaml.load(f.read())
48 + cf = yaml.load(f.read(), Loader = Loader)
49 db['drivers'].update(cf['drivers'].copy())
50 for key, d in db['drivers'].items():
52 @@ -158,7 +162,7 @@ class Database(object):
54 for path in glob.glob(configdir + '/*.conf'):
56 - cf = yaml.load(f.read())
57 + cf = yaml.load(f.read(), Loader = Loader)
58 configs[cf['config']['id']] = cf['config']
59 db['configs'] = configs
61 diff --git a/tools/check_configs.py b/tools/check_configs.py
62 index 1e0d831b..5e458de7 100755
63 --- a/tools/check_configs.py
64 +++ b/tools/check_configs.py
70 + from yaml import CLoader as Loader, CDumper as Dumper
72 + from yaml import Loader, Dumper