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.
Diff: script/replace_headers.py
- Revision:
- 0:bc2961fa1ef0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/script/replace_headers.py Wed Apr 06 23:55:04 2016 +0100
@@ -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()