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

summaryrefslogtreecommitdiffhomepage
path: root/tools/scripts/checkLicense.py
diff options
context:
space:
mode:
authorMartin Hořeňovský2020-11-10 11:10:03 +0100
committerGitHub2020-11-10 11:10:03 +0100
commit93312b369e5163bbf6eb80a9b6052aa5cdfebcc7 (patch)
treef419b5a2890d154c6198f468efe464afe345f04f /tools/scripts/checkLicense.py
parenta9941d42315b3d9db93a185666004b04d56af3e1 (diff)
parentd913837a5dd40a2a5bdc30d7ce6482d0a626746b (diff)
downloadcatch3-93312b369e5163bbf6eb80a9b6052aa5cdfebcc7.tar.gz
Merge pull request #2099 from innerout/check-license
Adds license check in CI
Diffstat (limited to 'tools/scripts/checkLicense.py')
-rw-r--r--tools/scripts/checkLicense.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/tools/scripts/checkLicense.py b/tools/scripts/checkLicense.py
new file mode 100644
index 00000000..3c2a14f4
--- /dev/null
+++ b/tools/scripts/checkLicense.py
@@ -0,0 +1,32 @@
+#!/usr/bin/env python3
+import os
+import sys
+
+
+def get_license():
+ with open("src/catch2/catch_all.hpp", "r") as f:
+ license = f.readlines()[0:7]
+
+ return license
+
+
+def check_license(license):
+ failed = 0
+ base_dir = "src/catch2/"
+
+ # The _ represents the list of directories in base_dir
+ for root, _, files in os.walk(base_dir):
+ for file in files:
+ with open(root + "/" + file, "r") as f:
+ file_license = f.readlines()[0:7]
+
+ if file_license != license:
+ print("File %s does not have license" % file)
+ failed = 1
+
+ return failed
+
+
+license = get_license()
+status = check_license(license)
+sys.exit(status)