5 licenses = ['BSD', 'FDL', 'LGPL']
8 for root, subdirs, files in os.walk(os.curdir):
10 if sfile.endswith(('.cpp', '.h', '.js', '.qs', '.qml', '.ui', \
11 '.g', '.sh', '.cmake', '.pod', '.qdoc', '.c', '.xsl', '.xml', \
13 lfiles.append('%s/%s' % (root, sfile))
15 def readlicense(sfile, replacedashes, replacehashes):
17 with open(sfile, 'r') as f:
19 for sline in f.readlines():
20 if 'QT_BEGIN_LICENSE' in sline:
22 elif 'QT_END_LICENSE' in sline:
23 sheader = '%s%s' % (sheader, sline)
26 sheader = '%s%s' % (sheader, sline)
28 sheader = sheader.replace('**', '--')
30 sheader = sheader.replace('**', '##')
34 with open(sfile, 'r') as f:
36 for license in licenses:
37 if ('$QT_BEGIN_LICENSE:%s$' % license) in scontent:
38 snewheader = readlicense('%s/header.%s' % (os.curdir, license),
39 sfile.endswith('.g'), sfile.endswith('.sh'))
40 soldheader = readlicense(sfile, False, False)
41 snewcontent = scontent.replace(soldheader, snewheader)
42 if not snewcontent == scontent:
43 with open(sfile, 'w') as f: