From 78ce6f02df652a57f257d933d0032d4f6d01a0a8 Mon Sep 17 00:00:00 2001 From: Olav Vitters Date: Sun, 6 Jul 2014 20:49:48 +0200 Subject: handle variations for py_requires as well as unneeded variable names --- mgagnome | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mgagnome b/mgagnome index f111195..7406d5f 100755 --- a/mgagnome +++ b/mgagnome @@ -390,8 +390,8 @@ class SpecFile(object): ('remove buildroot definition', re.compile(r'^BuildRoot:[^\n]+\n', re.MULTILINE + re.IGNORECASE)), ] re_convert_br = [ - ('remove py_requires', ('python',), re.compile(r'^\%py_requires[ \t]*\n', re.MULTILINE)), - ('remove py_requires -d', ('python', 'python-devel'), re.compile(r'^\%py_requires[ \t]+-d[ \t]*\n', re.MULTILINE)), + ('remove py_requires', ('python',), re.compile(r'^\%(?:py_requires|\{py_requires\})[ \t]*\n', re.MULTILINE)), + ('remove py_requires -d', ('python', 'python-devel'), re.compile(r'^\%(?:py_requires[ \t]+-d|\{py_requires[ \t]+-d\})[ \t]*\n', re.MULTILINE)), ] made_changes = False @@ -435,7 +435,7 @@ class SpecFile(object): # name: SOMETHING converted_defines = [] for search_for in ('name', 'version', 'release', 'summary', 'group'): - re_spec = re.compile(r'^(?P' + re.escape(search_for) + r'[ \t]*:[ \t]*)\%\{' + re.escape(search_for) + r'\}(?P[ \t]*\n)', re.MULTILINE + re.IGNORECASE) + re_spec = re.compile(r'^(?P' + re.escape(search_for) + r'[ \t]*:[ \t]*)(?:\%' + re.escape(search_for) + r'|\%\{' + re.escape(search_for) + r'\})(?P[ \t]*\n)', re.MULTILINE + re.IGNORECASE) regexp = r'^(?P\%define[ \t]+'+ re.escape(search_for) + r'[ \t]+(?P\S+))(?P[ \t]*\n)' re_variable = re.compile(r'^(?P\%define[ \t]+'+ re.escape(search_for) + r'[ \t]+(?P[^\n]+?))(?P[ \t]*\n)', re.MULTILINE + re.IGNORECASE) -- cgit v1.2.1