Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLeitwolf112026-09-25 00:56:24 +0300
committerLeitwolf112026-09-25 00:56:24 +0300
commitecf89607b787c10302c9e31b06ecda104791a617 (patch)
treeeeb17e2fab1d24135bc55a848889c73b089a29e4
parent3ca94ed8f321c6a8e4bbbe9ba316eecd8880537e (diff)
downloadcatch3-ecf89607b787c10302c9e31b06ecda104791a617.tar.gz
Validate upstream BSL and Progmasoft MPL headers separately in Catch3 CI
-rwxr-xr-xtools/scripts/checkLicense.py22
1 files changed, 16 insertions, 6 deletions
diff --git a/tools/scripts/checkLicense.py b/tools/scripts/checkLicense.py
index 7078d3ec..827c94b7 100755
--- a/tools/scripts/checkLicense.py
+++ b/tools/scripts/checkLicense.py
@@ -2,6 +2,7 @@
import sys
import glob
+from pathlib import Path
correct_licence = """\
@@ -13,11 +14,20 @@ correct_licence = """\
// SPDX-License-Identifier: BSL-1.0
"""
-def check_licence_in_file(filename: str) -> bool:
- with open(filename, 'r') as f:
- file_preamble = ''.join(f.readlines()[:7])
+progmasoft_licence = """\
+// Copyright (c) 2026 Progmasoft.
+// SPDX-License-Identifier: MPL-2.0 WITH AdditionRef-Progmasoft-Exception-1.1
+"""
- if correct_licence != file_preamble:
+def check_licence_in_file(filename: str) -> bool:
+ # Keep upstream files on BSL-1.0 while checking the fork's own source
+ # and tests against their separate MPL exception header.
+ expected = (progmasoft_licence if 'Progmasoft' in Path(filename).parts
+ else correct_licence)
+ with open(filename, 'r', encoding='utf-8') as f:
+ file_preamble = f.read(len(expected))
+
+ if expected != file_preamble:
print('File {} does not have proper licence'.format(filename))
return False
return True
@@ -33,8 +43,8 @@ def check_licences_in_path(path: str) -> int:
def check_licences():
failed = 0
- # Add 'extras' after the amalgamted files are regenerated with the new script (past 3.4.0)
- roots = ['src/catch2', 'tests', 'examples', 'fuzzing']
+ # Add 'extras' after the amalgamated files are regenerated with the new script (past 3.4.0)
+ roots = ['src/catch2', 'src/Progmasoft', 'tests', 'examples', 'fuzzing']
for root in roots:
failed += check_licences_in_path(root)