source: debug/switch.py @ 1145:f20c78f72ffc

Revision 1145:f20c78f72ffc, 1.7 KB checked in by Arc Riley <arcriley@…>, 11 years ago (diff)

AGPLv3 Upgrade (cont)

The switch script missed one of the lines

Line 
1
2import os
3
4def dirwalk(dir):
5  "walk a directory tree, using a generator"
6  for f in os.listdir(dir):
7    if f == '.svn' :
8      continue
9    fullpath = os.path.join(dir,f)
10    if os.path.isdir(fullpath) and not os.path.islink(fullpath):
11      for x in dirwalk(fullpath):  # recurse into subdir
12        yield x
13    else:
14      if f[-3:]!='.py' and f[-2:] != '.c' and f[-4:]!='.pyx' and f[-4:]!='.pxd' and f[-4:]!='.pxi':
15        continue
16      yield fullpath
17
18
19switch = {
20 '    it under the terms of the GNU Genera' :
21 '    it under the terms of the GNU Affero General Public License as published',
22
23 '#  it under the terms of the GNU General' :
24 '#  it under the terms of the GNU Affero General Public License as published',
25
26 '    the Free Software Foundation; either' :
27 '    by the Free Software Foundation, either version 3 of the License, or',
28
29 '#  the Free Software Foundation; either ' :
30 '#  by the Free Software Foundation, either version 3 of the License, or',
31 
32 '    GNU General Public License for more ' :
33 '    GNU Affero General Public License for more details.',
34
35 '#  GNU General Public License for more d' :
36 '#  GNU Affero General Public License for more details.',
37 
38 '    You should have received a copy of t' :
39 '    You should have received a copy of the GNU Affero General Public License',
40
41 '#  You should have received a copy of th' :
42 '#  You should have received a copy of the GNU Affero General Public License',
43}
44
45def doswitch(path) :
46  fr = open('../pysoy6/%s' % path[2:], 'r')
47  fw = open(path, 'w')
48  while 1 :
49    ln = fr.readline()
50    if ln == '' :
51      break
52    for s in switch :
53      if ln[:40] == s :
54        ln = '%s\n' % switch[s]
55     
56    fw.write(ln)
57  fr.close()
58  fw.close()     
59
60ds = dirwalk('./')
61for d in ds :
62  doswitch(d)
Note: See TracBrowser for help on using the repository browser.