CentOS compatibility: fix GitRepository._cmd_has_feature()
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Mon, 4 Mar 2013 11:17:24 +0000 (13:17 +0200)
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Tue, 7 Jan 2014 14:21:30 +0000 (16:21 +0200)
Make it work in CentOS 6.3 with older git by removing backspace
characters when examining man page section names.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
gbp/git/repository.py

index 872389cfbb54aca75e4d19344926f0bd00418360..e29385457a7d454f36c40215ca5958ad2f8783bc 100644 (file)
@@ -313,6 +313,7 @@ class GitRepository(object):
         section_re = re.compile(r'^(?P<section>[A-Z].*)')
         option_re = re.compile(r'--?(?P<name>[a-zA-Z\-]+).*')
         optopt_re = re.compile(r'--\[(?P<prefix>[a-zA-Z\-]+)\]-?')
+        backspace_re = re.compile(".\b")
         man_section = None
         for line in help.splitlines():
             if man_section == "OPTIONS" and line.startswith('       -'):
@@ -330,7 +331,7 @@ class GitRepository(object):
             # Check man section
             match = section_re.match(line)
             if match:
-                man_section = match.group('section')
+                man_section = backspace_re.sub('', match.group('section'))
         return False
 
     @property