Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of nrf51-sdk by
replace_headers.py
00001 import os 00002 00003 with open("copyright_header.txt", "r") as fd: 00004 header = fd.read() 00005 00006 path = "../source/nordic_sdk" 00007 for root, dirs, files in os.walk(path): 00008 for fn in [os.path.join(root, x) for x in files]: 00009 with open(fn, "r+") as fd: 00010 print "+"*35 00011 print fn 00012 s = fd.read() 00013 start = s.find("/*") 00014 end = s.find("*/") 00015 copyright_str = s[start:end+2] 00016 if "copyright (c)" not in copyright_str.lower(): 00017 s = header + "\n\n" + s 00018 elif copyright_str is not header: 00019 s = s.replace(copyright_str, header) 00020 00021 fd.seek(0) 00022 fd.write(s) 00023 fd.truncate()
Generated on Tue Jul 12 2022 16:37:11 by
