Skip to content

Commit

Permalink
automoc.py: set proper type prefix for match
Browse files Browse the repository at this point in the history
  • Loading branch information
fluxer committed May 7, 2015
1 parent 7e804f8 commit 4aa1acb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions automoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ def fwrite(sfile, content):
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'))

Expand Down

0 comments on commit 4aa1acb

Please sign in to comment.