From d800881a8e30186a421020bc56b089e2a8e29974 Mon Sep 17 00:00:00 2001 From: aqua Date: Mon, 5 Sep 2022 23:07:18 +0300 Subject: check_license.py: add BSD-3-Clause --- scripts/check_license.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/check_license.py b/scripts/check_license.py index c1d2a296..5f5b0351 100755 --- a/scripts/check_license.py +++ b/scripts/check_license.py @@ -17,14 +17,17 @@ def main(): ''' main function ''' parser = argparse.ArgumentParser(description='Check file for enabled license') parser.add_argument('file', type=open, nargs='+', help='File to check') - parser.add_argument('--isc', type=bool, default=True, help='ISC [default=True]') - parser.add_argument('--gpl2', type=bool, default=True, help='GPLv2+ [default=True]') - parser.add_argument('--gpl3', type=bool, default=True, help='GPLv3 only [default=True]') + parser.add_argument('--isc', action='store_false', help='ISC [default=True]') + parser.add_argument('--bsd', action='store_false', help='BSD-3-Clause [default=True]') + parser.add_argument('--gpl2', action='store_false', help='GPL-2.0-or-later [default=True]') + parser.add_argument('--gpl3', action='store_false', help='GPL-3.0-only [default=True]') args = parser.parse_args() licenses = [] if args.isc: licenses.append('ISC') + if args.bsd: + licenses.append('BSD-3-Clause') if args.gpl2: licenses.append('GPL-2.0-or-later') if args.gpl3: @@ -37,7 +40,6 @@ def main(): if not file.name.endswith(('.h', '.hh', '.hpp', '.c', '.cc', '.cpp')): continue - print(f'{ file.name }') # check for header start line = file.readline() if re.search(r'^\/\* ={60}$', line) is None: @@ -51,10 +53,8 @@ def main(): lic = re.search(r'^\s\* SPDX-License-Identifier: ([\w\d.-]{3,})$', line) if lic is not None: found = lic.group(1) - if found in licenses: - print(f'found license: { found }') - else: - print(f'found license { found } not in licenses { licenses }') + if found not in licenses: + print(f'{ file.name }: found license { found } not in licenses { licenses }') has_errors = True line = file.readline() -- cgit v1.2.1