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'))