From 4aa1acb12439e6ff2cf31b2beed29834a63b04da Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Thu, 7 May 2015 14:52:19 +0000 Subject: [PATCH] automoc.py: set proper type prefix for match --- automoc.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/automoc.py b/automoc.py index 229f9a7..a08aa00 100644 --- a/automoc.py +++ b/automoc.py @@ -21,16 +21,16 @@ for sroot, ldirs, lfiles in os.walk(directory): for sfile in lfiles: sfull = os.path.join(sroot, sfile) if sfile.endswith(('.h', '.hh', '.hpp', '.c', '.cc', '.cpp')): - smatch = re.findall('(\n#include (?:"|<)(.*/)?(.*).moc(?:"|>))', fread(sfull)) - if smatch and not re.findall('Q_OBJECT', fread(sfull)): + lmatch = re.findall('(\n#include (?:"|<)(.*/)?(.*).moc(?:"|>))', fread(sfull)) + if lmatch and not re.findall('Q_OBJECT', fread(sfull)): print('Adjusting moc inclusion of', sfull) - for match in smatch: + for match in lmatch: fwrite(sfull, fread(sfull).replace(match[0], \ '\n#include "%smoc_%s.cpp"' % (match[1], match[2]))) elif sfile.endswith('CMakeLists.txt'): - smatch = re.findall('(automoc4_add_library)', fread(sfull)) - if smatch: + lmatch = re.findall('(automoc4_add_library)', fread(sfull)) + if lmatch: print('Adjusting automoc4_add_library of', sfull) fwrite(sfull, fread(sfull).replace('\nautomoc4_add_library', '\nadd_library'))