diff options
author | Olav Vitters <olav@vitters.nl> | 2014-07-21 23:37:38 +0200 |
---|---|---|
committer | Olav Vitters <olav@vitters.nl> | 2014-07-21 23:37:38 +0200 |
commit | 0ace25ca210cbd7d267644fd4e37c419b5c34afa (patch) | |
tree | e1c13650a1f72e0700080c95498a63361a7d077e | |
parent | 4c69a7c0bbe7d8388b2f6f536ef0c8e9af4db5b9 (diff) | |
download | mgagnome-0ace25ca210cbd7d267644fd4e37c419b5c34afa.tar mgagnome-0ace25ca210cbd7d267644fd4e37c419b5c34afa.tar.gz mgagnome-0ace25ca210cbd7d267644fd4e37c419b5c34afa.tar.bz2 mgagnome-0ace25ca210cbd7d267644fd4e37c419b5c34afa.tar.xz mgagnome-0ace25ca210cbd7d267644fd4e37c419b5c34afa.zip |
case sensitive variable replacement
-rwxr-xr-x | mgagnome | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -437,9 +437,10 @@ class SpecFile(object): # Into # 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'|\%\{' + re.escape(search_for) + r'\})(?P<keeppost>[ \t]*\n)', re.MULTILINE + re.IGNORECASE) - 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) + for search_for in ('name', 'version', 'release', 'summary', 'Summary', 'group'): + search_for_ignore_case = ''.join(("[%s%s]" % (letter, letter.swapcase()) for letter in a)) + re_spec = re.compile(r'^(?P<keeppre>' + re.escape(search_for_ignore_case) + r'[ \t]*:[ \t]*)(?:\%' + re.escape(search_for) + r'|\%\{' + re.escape(search_for) + r'\})(?P<keeppost>[ \t]*\n)', re.MULTILINE) + re_variable = re.compile(r'^(?P<keeppre>\%define[ \t]+'+ re.escape(search_for) + r'[ \t]+(?P<definition>[^\n]+?))(?P<keeppost>[ \t]*\n)', re.MULTILINE) mo = re_variable.search(data) if mo and mo.group('definition') and len(re_variable.findall(data)) == 1: |