OFF_SEQ = "\033[0m"
def __init__(self, stream=None, color='auto'):
- super(GbpStreamHandler, self).__init__(stream)
+ logging.StreamHandler.__init__(self, stream)
self._color = gbp.tristate.Tristate(color)
self._color_scheme = DEFAULT_COLOR_SCHEME.copy()
msg_fmt = "%(color)s%(name)s:%(levelname)s: %(message)s%(coloroff)s"
record.color = self.COLOR_SEQ % self._color_scheme[record.levelno]
record.coloroff = self.OFF_SEQ
record.levelname = record.levelname.lower()
- return super(GbpStreamHandler, self).format(record)
+ return logging.StreamHandler.format(self, record)
class GbpLogger(logging.Logger):
"""Logger class for git-buildpackage"""
def __init__(self, name, color='auto', *args, **kwargs):
- super(GbpLogger, self).__init__(name, *args, **kwargs)
+ logging.Logger.__init__(self, name, *args, **kwargs)
self._default_handlers = [GbpStreamHandler(sys.stdout, color),
GbpStreamHandler(sys.stderr, color)]
self._default_handlers[0].addFilter(GbpFilter([DEBUG, INFO]))
def _patches(self):
"""Get all patch tags as a dict"""
+ patches = {}
if 'patch' not in self._tags:
return {}
- return {patch['num']: patch for patch in self._tags['patch']['lines']}
+ for patch in self._tags['patch']['lines']:
+ patches[patch['num']] = patch
+ return patches
def _sources(self):
"""Get all source tags as a dict"""
+ sources = {}
if 'source' not in self._tags:
return {}
- return {src['num']: src for src in self._tags['source']['lines']}
+ for src in self._tags['source']['lines']:
+ sources[src['num']] = src
+ return sources
def sources(self):
"""Get all source tags as a dict"""
- return {src['num']: src['linevalue']
- for src in self._sources().values()}
+ sources = {}
+ for src in self._sources().values():
+ sources[src['num']] = src['linevalue']
+ return sources
def _macro_replace(self, matchobj):
macro_dict = {'name': self.name,