2019-12-30 12:59:52 -05:00
|
|
|
import configparser
|
|
|
|
import logging
|
|
|
|
from collections import OrderedDict
|
|
|
|
|
|
|
|
|
2020-01-03 03:38:35 -05:00
|
|
|
# TODO: Add pacman.conf parsing?
|
|
|
|
|
|
|
|
|
2019-12-30 12:59:52 -05:00
|
|
|
_logger = logging.getLogger('pacman:_common')
|
|
|
|
|
|
|
|
|
|
|
|
class MultiOrderedDict(OrderedDict):
|
|
|
|
# Thanks, dude: https://stackoverflow.com/a/38286559/733214
|
|
|
|
def __setitem__(self, key, value):
|
|
|
|
if key in self:
|
|
|
|
if isinstance(value, list):
|
|
|
|
self[key].extend(value)
|
|
|
|
return(None)
|
|
|
|
elif isinstance(value, str):
|
|
|
|
if len(self[key]) > 1:
|
|
|
|
return(None)
|
|
|
|
super(MultiOrderedDict, self).__setitem__(key, value)
|