mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-28 19:20:54 +00:00
add worning on copyright missing
This commit is contained in:
parent
97e453d994
commit
4dd7c61ba1
@ -45,21 +45,20 @@ onlyDumpDifferentCopyright = True
|
|||||||
copyrightString = "Copyright (C) 2014 BlueKitchen GmbH"
|
copyrightString = "Copyright (C) 2014 BlueKitchen GmbH"
|
||||||
copyrighters = ["BlueKitchen", "Matthias Ringwald"]
|
copyrighters = ["BlueKitchen", "Matthias Ringwald"]
|
||||||
|
|
||||||
ignoreFolders = ["cpputest", "msp-exp430f5438-cc2564b", "msp430f5229lp-cc2564b", "ez430-rf2560", "ios"]
|
ignoreFolders = ["cpputest", "test", "msp-exp430f5438-cc2564b", "msp430f5229lp-cc2564b", "ez430-rf2560", "ios", "chipset-cc256x", "docs", "mtk"]
|
||||||
ignoreFiles = ["ant_cmds.h"]
|
ignoreFiles = ["ant_cmds.h", "rijndael.c", "btstack-config.h", "version.h", "profile.h", "bluetoothdrv.h",
|
||||||
|
"ancs_client.h", "spp_and_le_counter.h", "bluetoothdrv-stub.c", "minimal_peripheral.c", "BTstackDaemonRespawn.c"]
|
||||||
|
|
||||||
class State:
|
class State:
|
||||||
SearchStartComment = 0
|
SearchStartComment = 0
|
||||||
SearchCopyrighter = 1
|
SearchCopyrighter = 1
|
||||||
SearchEndComment = 2
|
|
||||||
EndSearch = 3
|
|
||||||
|
|
||||||
def updateCopyright(file_name):
|
def updateCopyright(file_name):
|
||||||
global onlyDumpDifferentCopyright
|
global onlyDumpDifferentCopyright
|
||||||
if not onlyDumpDifferentCopyright:
|
if not onlyDumpDifferentCopyright:
|
||||||
print file_name, ": Update copyright"
|
print file_name, ": Update copyright"
|
||||||
|
|
||||||
def analyseCopyright(file_name):
|
def requiresCopyrightUpdate(file_name):
|
||||||
global copyrightString, onlyDumpDifferentCopyright
|
global copyrightString, onlyDumpDifferentCopyright
|
||||||
|
|
||||||
with open(file_name, "rb") as fin:
|
with open(file_name, "rb") as fin:
|
||||||
@ -81,20 +80,14 @@ def analyseCopyright(file_name):
|
|||||||
allowedCopyrighters = re.match('.*('+name+').*',line, re.I)
|
allowedCopyrighters = re.match('.*('+name+').*',line, re.I)
|
||||||
if allowedCopyrighters:
|
if allowedCopyrighters:
|
||||||
allowedCopyrighterFound = True
|
allowedCopyrighterFound = True
|
||||||
if not (re.match(copyrightString,line)):
|
return re.match(copyrightString,line)
|
||||||
updateCopyright(file_name)
|
|
||||||
if not allowedCopyrighterFound and onlyDumpDifferentCopyright:
|
if onlyDumpDifferentCopyright:
|
||||||
print file_name, ": Copyrighter not allowed > ", parts.group()
|
print file_name, ": Copyrighter not allowed > ", parts.group()
|
||||||
state = State.SearchEndComment
|
return False
|
||||||
|
|
||||||
if state == State.SearchEndComment:
|
print file_name, ": File has no copyright"
|
||||||
parts = re.match('\s*(\*/).*',line, re.I)
|
return False
|
||||||
if parts:
|
|
||||||
state = State.EndSearch
|
|
||||||
|
|
||||||
if state == State.EndSearch:
|
|
||||||
continue
|
|
||||||
fin.close()
|
|
||||||
|
|
||||||
for root, dirs, files in os.walk('../', topdown=True):
|
for root, dirs, files in os.walk('../', topdown=True):
|
||||||
dirs[:] = [d for d in dirs if d not in ignoreFolders]
|
dirs[:] = [d for d in dirs if d not in ignoreFolders]
|
||||||
@ -102,7 +95,8 @@ for root, dirs, files in os.walk('../', topdown=True):
|
|||||||
for f in files:
|
for f in files:
|
||||||
if f.endswith(".h") or f.endswith(".c"):
|
if f.endswith(".h") or f.endswith(".c"):
|
||||||
file_name = root + "/" + f
|
file_name = root + "/" + f
|
||||||
analyseCopyright(file_name)
|
if requiresCopyrightUpdate(file_name):
|
||||||
|
updateCopyright(file_name)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user