Lancaster University fork of the Nordic nrf51-SDK repository, which actually lives on github: https://github.com/lancaster-university/nrf51-sdk

Dependents:   nRF51822

Committer:
Jonathan Austin
Date:
Fri Apr 08 15:11:33 2016 +0100
Revision:
8:fc9c9d6f097d
Parent:
0:bc2961fa1ef0
Prefer the same changes from git

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jonathan Austin 0:bc2961fa1ef0 1 import os
Jonathan Austin 0:bc2961fa1ef0 2
Jonathan Austin 0:bc2961fa1ef0 3 with open("copyright_header.txt", "r") as fd:
Jonathan Austin 0:bc2961fa1ef0 4 header = fd.read()
Jonathan Austin 0:bc2961fa1ef0 5
Jonathan Austin 0:bc2961fa1ef0 6 path = "../source/nordic_sdk"
Jonathan Austin 0:bc2961fa1ef0 7 for root, dirs, files in os.walk(path):
Jonathan Austin 0:bc2961fa1ef0 8 for fn in [os.path.join(root, x) for x in files]:
Jonathan Austin 0:bc2961fa1ef0 9 with open(fn, "r+") as fd:
Jonathan Austin 0:bc2961fa1ef0 10 print "+"*35
Jonathan Austin 0:bc2961fa1ef0 11 print fn
Jonathan Austin 0:bc2961fa1ef0 12 s = fd.read()
Jonathan Austin 0:bc2961fa1ef0 13 start = s.find("/*")
Jonathan Austin 0:bc2961fa1ef0 14 end = s.find("*/")
Jonathan Austin 0:bc2961fa1ef0 15 copyright_str = s[start:end+2]
Jonathan Austin 0:bc2961fa1ef0 16 if "copyright (c)" not in copyright_str.lower():
Jonathan Austin 0:bc2961fa1ef0 17 s = header + "\n\n" + s
Jonathan Austin 0:bc2961fa1ef0 18 elif copyright_str is not header:
Jonathan Austin 0:bc2961fa1ef0 19 s = s.replace(copyright_str, header)
Jonathan Austin 0:bc2961fa1ef0 20
Jonathan Austin 0:bc2961fa1ef0 21 fd.seek(0)
Jonathan Austin 0:bc2961fa1ef0 22 fd.write(s)
Jonathan Austin 0:bc2961fa1ef0 23 fd.truncate()