relicense.py
Go to the documentation of this file.
1 # This file is part of Eigen, a lightweight C++ template library
2 # for linear algebra.
3 #
4 # Copyright (C) 2012 Keir Mierle <mierle@gmail.com>
5 #
6 # This Source Code Form is subject to the terms of the Mozilla
7 # Public License v. 2.0. If a copy of the MPL was not distributed
8 # with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 #
10 # Author: mierle@gmail.com (Keir Mierle)
11 #
12 # Make the long-awaited conversion to MPL.
13 
14 lgpl3_header = '''
15 // Eigen is free software; you can redistribute it and/or
16 // modify it under the terms of the GNU Lesser General Public
17 // License as published by the Free Software Foundation; either
18 // version 3 of the License, or (at your option) any later version.
19 //
20 // Alternatively, you can redistribute it and/or
21 // modify it under the terms of the GNU General Public License as
22 // published by the Free Software Foundation; either version 2 of
23 // the License, or (at your option) any later version.
24 //
25 // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
26 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
27 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
28 // GNU General Public License for more details.
29 //
30 // You should have received a copy of the GNU Lesser General Public
31 // License and a copy of the GNU General Public License along with
32 // Eigen. If not, see <http://www.gnu.org/licenses/>.
33 '''
34 
35 mpl2_header = """
36 // This Source Code Form is subject to the terms of the Mozilla
37 // Public License v. 2.0. If a copy of the MPL was not distributed
38 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
39 """
40 
41 import os
42 import sys
43 
44 exclusions = set(['relicense.py'])
45 
46 def update(text):
47  if text.find(lgpl3_header) == -1:
48  return text, False
49  return text.replace(lgpl3_header, mpl2_header), True
50 
51 rootdir = sys.argv[1]
52 for root, sub_folders, files in os.walk(rootdir):
53  for basename in files:
54  if basename in exclusions:
55  print 'SKIPPED', filename
56  continue
57  filename = os.path.join(root, basename)
58  fo = file(filename)
59  text = fo.read()
60  fo.close()
61 
62  text, updated = update(text)
63  if updated:
64  fo = file(filename, "w")
65  fo.write(text)
66  fo.close()
67  print 'UPDATED', filename
68  else:
69  print ' ', filename
relicense.update
def update(text)
Definition: relicense.py:46
set
Definition: pytypes.h:2232
matlab_wrap.file
file
Definition: matlab_wrap.py:57


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:03:58