mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 00:55:31 +00:00
added missing Copyright forms
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
004bf1471f
commit
b08ccc7816
76 changed files with 504 additions and 0 deletions
54
scripts/mk_copyright.py
Normal file
54
scripts/mk_copyright.py
Normal file
|
@ -0,0 +1,54 @@
|
|||
import os
|
||||
import re
|
||||
|
||||
cr = re.compile("Copyright")
|
||||
aut = re.compile("Automatically generated")
|
||||
|
||||
cr_notice = """
|
||||
/*++
|
||||
Copyright (c) 2015 Microsoft Corporation
|
||||
|
||||
--*/
|
||||
|
||||
"""
|
||||
|
||||
def has_cr(file):
|
||||
ins = open(file)
|
||||
lines = 0
|
||||
line = ins.readline()
|
||||
while line and lines < 20:
|
||||
m = cr.search(line)
|
||||
if m:
|
||||
ins.close()
|
||||
return True
|
||||
m = aut.search(line)
|
||||
if m:
|
||||
ins.close()
|
||||
return True
|
||||
line = ins.readline()
|
||||
ins.close()
|
||||
return False
|
||||
|
||||
def add_cr(file):
|
||||
tmp = "%s.tmp" % file
|
||||
ins = open(file)
|
||||
ous = open(tmp,'w')
|
||||
ous.write(cr_notice)
|
||||
line = ins.readline()
|
||||
while line:
|
||||
ous.write(line)
|
||||
line = ins.readline()
|
||||
ins.close()
|
||||
ous.close()
|
||||
os.system("move %s %s" % (tmp, file))
|
||||
|
||||
def add_missing_cr():
|
||||
for root, dirs, files in os.walk('src'):
|
||||
for f in files:
|
||||
if f.endswith('.cpp') or f.endswith('.h'):
|
||||
path = "%s\\%s" % (root, f)
|
||||
if not has_cr(path):
|
||||
print "Missing CR for %s" % path
|
||||
add_cr(path)
|
||||
|
||||
add_missing_cr()
|
Loading…
Add table
Add a link
Reference in a new issue