From 41fdcb2323d3b75391e5bdd74497403f58e1a36d Mon Sep 17 00:00:00 2001 From: lhinds Date: Tue, 11 Jul 2017 17:36:38 +0100 Subject: Fix for CCL 4.0 Licenses. A follow up patch should move the patterns list into yaml Change-Id: Id814d6fc09631d5037f6825f32daca8d74edc118 Signed-off-by: lhinds --- anteater/src/patch_scan.py | 6 +++--- anteater/src/project_scan.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'anteater') diff --git a/anteater/src/patch_scan.py b/anteater/src/patch_scan.py index 0a32f3e..1deb68f 100644 --- a/anteater/src/patch_scan.py +++ b/anteater/src/patch_scan.py @@ -147,9 +147,9 @@ def licence_check(project, licence_ext, # Note: Hardcoded use of 'copyright' & 'spdx' is the result # of a decision made at 2017 plugfest to limit searches to # just these two strings. - if re.search("copyright", content, re.IGNORECASE): - logger.info('Contains needed Licence string: %s', patch_file) - elif re.search("spdx", content, re.IGNORECASE): + patterns = ['copyright', 'spdx', + 'http://creativecommons.org/licenses/by/4.0'] + if any(i in content.lower() for i in patterns): logger.info('Contains needed Licence string: %s', patch_file) else: logger.error('Licence header missing in file: %s', patch_file) diff --git a/anteater/src/project_scan.py b/anteater/src/project_scan.py index f33ccca..5ac8b10 100644 --- a/anteater/src/project_scan.py +++ b/anteater/src/project_scan.py @@ -159,9 +159,9 @@ def licence_check(licence_ext, licence_ignore, project, project_dir): # Note: Hardcoded use of 'copyright' & 'spdx' is the result # of a decision made at 2017 plugfest to limit searches to # just these two strings. - if re.search("copyright", content, re.IGNORECASE): - logger.info('Licence string present: %s', full_path) - elif re.search("spdx", content, re.IGNORECASE): + patterns = ['copyright', 'spdx', + 'http://creativecommons.org/licenses/by/4.0'] + if any(i in content.lower() for i in patterns): logger.info('Licence string present: %s', full_path) else: logger.error('Licence header missing: %s', full_path) -- cgit 1.2.3-korg