summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlav Vitters <olav@vitters.nl>2014-07-06 20:49:48 +0200
committerOlav Vitters <olav@vitters.nl>2014-07-06 20:49:48 +0200
commit78ce6f02df652a57f257d933d0032d4f6d01a0a8 (patch)
tree02f6f95840d9fa8aa4e23da0d040e08f5298f31d
parentc1cbcf06da762372d31bc69ab8b09e9d1c03bc34 (diff)
downloadmgagnome-78ce6f02df652a57f257d933d0032d4f6d01a0a8.tar
mgagnome-78ce6f02df652a57f257d933d0032d4f6d01a0a8.tar.gz
mgagnome-78ce6f02df652a57f257d933d0032d4f6d01a0a8.tar.bz2
mgagnome-78ce6f02df652a57f257d933d0032d4f6d01a0a8.tar.xz
mgagnome-78ce6f02df652a57f257d933d0032d4f6d01a0a8.zip
handle variations for py_requires as well as unneeded variable names
-rwxr-xr-xmgagnome6
1 files 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<keeppre>' + re.escape(search_for) + r'[ \t]*:[ \t]*)\%\{' + re.escape(search_for) + r'\}(?P<keeppost>[ \t]*\n)', re.MULTILINE + re.IGNORECASE)
+ re_spec = re.compile(r'^(?P<keeppre>' + re.escape(search_for) + r'[ \t]*:[ \t]*)(?:\%' + re.escape(search_for) + r'|\%\{' + re.escape(search_for) + r'\})(?P<keeppost>[ \t]*\n)', re.MULTILINE + re.IGNORECASE)
regexp = r'^(?P<keeppre>\%define[ \t]+'+ re.escape(search_for) + r'[ \t]+(?P<variable>\S+))(?P<keeppost>[ \t]*\n)'
re_variable = re.compile(r'^(?P<keeppre>\%define[ \t]+'+ re.escape(search_for) + r'[ \t]+(?P<definition>[^\n]+?))(?P<keeppost>[ \t]*\n)', re.MULTILINE + re.IGNORECASE)