Package list lightdm-gtk-greeter-settings / 1ca7b41
Handling some conf errors Andrew P. 7 years ago
1 changed file(s) with 11 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
1616
1717 import configparser
1818 import os
19 import sys
1920 from collections import OrderedDict
2021 from glob import iglob
2122
9798 files.append(os.path.join(path, self._base_dir, self._base_name))
9899
99100 for path in filter(os.path.isfile, files):
100 config_file = configparser.RawConfigParser(strict=False)
101 if not config_file.read(path):
101 config_file = configparser.RawConfigParser(strict=False, allow_no_value=True)
102 try:
103 if not config_file.read(path):
104 continue
105 except configparser.Error as e:
106 print(e, file=sys.stderr)
102107 continue
103108
104109 for groupname, values in config_file.items():
110115 group = self._groups[groupname]
111116
112117 for key, value in values.items():
118 if value is None:
119 print('[{group}] {key}: Keys without values are not allowed'.format(
120 group=groupname, key=key), file=sys.stderr)
121 continue
113122 if key.startswith('-'):
114123 key = key[1:]
115124 value = None