summaryrefslogtreecommitdiff
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>2013-03-08 14:04:00 +0200
commit63caf726b1b987d936b074abb32c52dd19f251e0 (patch)
tree223a61b2b8934ee1adbd0b43bbb1a492f19b11a4
parent09a0b8b5c877102028ec4f56f4da3f301b9b3c82 (diff)
downloadgit-buildpackage-63caf726b1b987d936b074abb32c52dd19f251e0.tar.gz
git-buildpackage-63caf726b1b987d936b074abb32c52dd19f251e0.tar.bz2
git-buildpackage-63caf726b1b987d936b074abb32c52dd19f251e0.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>
-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 82d8bf10..3417b74b 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 38ef9e6b..6698e30a 100644
--- a/gbp/rpm/__init__.py
+++ b/gbp/rpm/__init__.py
@@ -202,20 +202,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,
@@ -622,8 +630,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()):