mirror of
https://bitbucket.org/smil3y/katana.git
synced 2025-02-23 18:32:47 +00:00
automoc.py: apply fixup to all found occurances in file
This commit is contained in:
parent
80a2761282
commit
cdda09ba49
1 changed files with 4 additions and 4 deletions
|
@ -1,7 +1,6 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# a script to migrate from automoc4 to CMake automoc,
|
||||
# you may have to run it more than once to get the good result
|
||||
# a script to migrate from automoc4 to CMake automoc
|
||||
|
||||
import os, re
|
||||
|
||||
|
@ -25,8 +24,9 @@ for sroot, ldirs, lfiles in os.walk(directory):
|
|||
smatch = re.findall('(\n#include (?:"|<)(.*/)?(.*).moc(?:"|>))', fread(sfull))
|
||||
if smatch and not re.findall('Q_OBJECT', fread(sfull)):
|
||||
print('Adjusting moc inclusion of', sfull)
|
||||
fwrite(sfull, fread(sfull).replace(smatch[0][0], \
|
||||
'\n#include "%smoc_%s.cpp"' % (smatch[0][1], smatch[0][2])))
|
||||
for match in smatch:
|
||||
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))
|
||||
|
|
Loading…
Add table
Reference in a new issue