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