Add script to change license headers for sdk files
This commit is contained in:
parent
0a1acfc5f9
commit
482c6e36d7
2 changed files with 54 additions and 0 deletions
31
script/copyright_header.txt
Normal file
31
script/copyright_header.txt
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (c) Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this
|
||||
* list of conditions and the following disclaimer in the documentation and/or
|
||||
* other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of Nordic Semiconductor ASA nor the names of other
|
||||
* contributors to this software may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
23
script/replace_headers.py
Normal file
23
script/replace_headers.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
import os
|
||||
|
||||
with open("copyright_header.txt", "r") as fd:
|
||||
header = fd.read()
|
||||
|
||||
path = "../source/nordic_sdk"
|
||||
for root, dirs, files in os.walk(path):
|
||||
for fn in [os.path.join(root, x) for x in files]:
|
||||
with open(fn, "r+") as fd:
|
||||
print "+"*35
|
||||
print fn
|
||||
s = fd.read()
|
||||
start = s.find("/*")
|
||||
end = s.find("*/")
|
||||
copyright_str = s[start:end+2]
|
||||
if "copyright (c)" not in copyright_str.lower():
|
||||
s = header + "\n\n" + s
|
||||
elif copyright_str is not header:
|
||||
s = s.replace(copyright_str, header)
|
||||
|
||||
fd.seek(0)
|
||||
fd.write(s)
|
||||
fd.truncate()
|
Loading…
Reference in a new issue