aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2017-07-27 22:13:54 +0100
committerYann Herklotz <ymherklotz@gmail.com>2017-07-27 22:13:54 +0100
commit664c0a3ad0387f19028c850962b034a4fec4616b (patch)
treec3424fd8de775d445b400a6c2ad97932ec5558f1 /scripts
parenta94e71c3f001d7e2d0b4743739e268aa051fd98f (diff)
downloadYAGE-664c0a3ad0387f19028c850962b034a4fec4616b.tar.gz
YAGE-664c0a3ad0387f19028c850962b034a4fec4616b.zip
No licenses but added script to add the license to every file
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/add_version_headers40
1 files changed, 40 insertions, 0 deletions
diff --git a/scripts/add_version_headers b/scripts/add_version_headers
new file mode 100755
index 00000000..4c182763
--- /dev/null
+++ b/scripts/add_version_headers
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+# -----------------------------------------------------------------------------
+# add_version_headers.py -- Add version header
+#
+# Copyright (c) 2017 Yann Herklotz Grave (ymherklotz@gmail.com) -- MIT License
+# -----------------------------------------------------------------------------
+
+import os
+import re
+import sys
+
+
+header = """/* ---------------------------------------------------------------\
+-------------
+ * {0}
+ *
+ * Copyright (c) 2017 Yann Herklotz Grave <ymherklotz@gmail.com> -- MIT License
+ * See file LICENSE for more details
+ * ----------------------------------------------------------------------------
+ */
+"""
+
+
+def main(argv):
+ print("files getting a license: ")
+ for subdir, dirs, files in os.walk(os.getcwd()):
+ if not re.match(".*build.*", subdir):
+ for file_ in files:
+ if re.match(".*[.]cpp$|.*[.]hpp$", file_) and not re.match("^picopng[.]cpp$", file_):
+ print(os.path.join(subdir, file_))
+ with open(os.path.join(subdir, file_), 'r') as src_file:
+ src = src_file.read()
+ with open(os.path.join(subdir, file_), 'w') as src_file_lic:
+ src_file_lic.write(header.format(file_))
+ src_file_lic.write(src)
+ print("Done")
+
+
+if __name__ == "__main__":
+ main(sys.argv)