blob: 2c0ba1dfeb2da70faca6e162609585d240a803e6 (
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
|
#!/usr/bin/env python
import os
import re
def handleFile(path):
lines = file(path).readlines()
lineNumber = 0
found = False
for i, line in enumerate(lines):
match = re.match(r'((//)|(#))\s*Copyright \(C\) 2003-(.*) Ulrich von Zadow\s*', line)
# m = re.match(r'#include\s*["<]([\-_a-zA-Z0-9\.\\/]+)[">]\s*', l)
if match:
if path[-2:] == 'py':
lines[i] = "# Copyright (C) 2003-2014 Ulrich von Zadow\n"
else:
lines[i] = "// Copyright (C) 2003-2014 Ulrich von Zadow\n"
found = True
if found:
outFile = open(path, "w")
for line in lines:
outFile.write(line)
else:
print path
for ext in ("h", "c", "cpp", "py"):
cmd = 'find . -name "*.'+ext+'"'
files = os.popen(cmd).readlines()
for f in files:
handleFile(f.strip())
|