configfile: Ignore trailing comments starting with a semicolon

Newer versions of configparser no longer default to ignoring trailing
comments that start with a semicolon.  Add that setting explicitly to
avoid breaking existing config files.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2021-10-06 14:07:32 -04:00
parent cc63fd51b2
commit c7b65f50e3
1 changed files with 2 additions and 1 deletions

View File

@ -255,7 +255,8 @@ class PrinterConfig:
self._parse_config_buffer(buffer, filename, fileconfig) self._parse_config_buffer(buffer, filename, fileconfig)
visited.remove(path) visited.remove(path)
def _build_config_wrapper(self, data, filename): def _build_config_wrapper(self, data, filename):
fileconfig = configparser.RawConfigParser(strict=False) fileconfig = configparser.RawConfigParser(
strict=False, inline_comment_prefixes=(';','#'))
self._parse_config(data, filename, fileconfig, set()) self._parse_config(data, filename, fileconfig, set())
return ConfigWrapper(self.printer, fileconfig, {}, 'printer') return ConfigWrapper(self.printer, fileconfig, {}, 'printer')
def _build_config_string(self, config): def _build_config_string(self, config):