blob: bdf9e32ea7c58517167350517096b4e270237c68 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#!/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)
|