summaryrefslogtreecommitdiff
path: root/gbp
diff options
context:
space:
mode:
authorZhang Qiang <qiang.z.zhang@intel.com>2013-02-08 14:09:26 +0800
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>2014-01-14 13:48:23 +0200
commit9501982149f9a5bb9c7933058353aef7ffdaf6fa (patch)
tree48fed3b4b5ca8d6e7b43034ce00446419122bbdb /gbp
parent6de13cbb58077e10a025128f10c6f739f3c8fb6c (diff)
downloadgit-buildpackage-9501982149f9a5bb9c7933058353aef7ffdaf6fa.tar.gz
git-buildpackage-9501982149f9a5bb9c7933058353aef7ffdaf6fa.tar.bz2
git-buildpackage-9501982149f9a5bb9c7933058353aef7ffdaf6fa.zip
CentOS compatibility: make GBP work with older python2.6
- use loops to generate dict/list - Called logging.Logger.__init__ instead of using super(). In python 2.6 logging.Logger is not new-style class, therefore supper() is failing. Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com> Signed-off-by: Zhang Qiang <qiang.z.zhang@intel.com> Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'gbp')
-rw-r--r--gbp/log.py6
-rw-r--r--gbp/rpm/__init__.py21
2 files changed, 18 insertions, 9 deletions
diff --git a/gbp/log.py b/gbp/log.py
index f21e2bbd..1e177d41 100644
--- a/gbp/log.py
+++ b/gbp/log.py
@@ -52,7 +52,7 @@ class GbpStreamHandler(logging.StreamHandler):
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"
@@ -88,14 +88,14 @@ class GbpStreamHandler(logging.StreamHandler):
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]))
diff --git a/gbp/rpm/__init__.py b/gbp/rpm/__init__.py
index 72a846db..6ed93034 100644
--- a/gbp/rpm/__init__.py
+++ b/gbp/rpm/__init__.py
@@ -204,20 +204,28 @@ class SpecFile(object):
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']: os.path.basename(src['linevalue'])
- for src in self._sources().values()}
+ sources = {}
+ for src in self._sources().values():
+ sources[src['num']] = os.path.basename(src['linevalue'])
+ return sources
def _macro_replace(self, matchobj):
macro_dict = {'name': self.name,
@@ -643,8 +651,9 @@ class SpecFile(object):
series = PatchSeries()
if 'patch' in self._tags:
tags = self._patches()
- macros = {macro['id']: macro['args']
- for macro in self._special_directives['patch']}
+ macros = {}
+ for macro in self._special_directives['patch']:
+ macros[macro['id']] = macro['args']
ignored = [] if ignored else self.ignorepatches
for num, tag in sorted(tags.iteritems()):