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>
Fri, 14 Nov 2014 12:46:24 +0000 (14:46 +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 b6a05e2..16e1375 100644 (file)
@@ -321,6 +321,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('       -'):
@@ -338,7 +339,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