From 3fa22716004703f05fc08c12726fadfd91da9d34 Mon Sep 17 00:00:00 2001 From: Tobias Markmann Date: Wed, 6 Jul 2016 11:58:07 +0200 Subject: Add script to produce summary of copyright headers Test-Information: Added debug output and checked that each file that was not automatically generated at build time was taken into account and had at least one copyright name extracted. Tested some samples that the names returned are correct. Change-Id: Ie652c78ecd0b91247e68fa6963a3f9a3a632fc66 diff --git a/BuildTools/ProjectCopyrightSummary.py b/BuildTools/ProjectCopyrightSummary.py new file mode 100755 index 0000000..6e2d824 --- /dev/null +++ b/BuildTools/ProjectCopyrightSummary.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python + +import fnmatch +import os +import re +from sets import Set + +projectSourceFiles = [] +for directory in ['Documentation', 'Limber', 'Packages', 'QA', 'Slimber', 'Sluift', 'Swift', 'Swiften', 'SwifTools']: + for root, dirnames, filenames in os.walk(directory): + for filename in filenames: + if any(fnmatch.fnmatch(filename, pattern) for pattern in ['*.cpp', '*.h', '*.mm', '*.m', '*.c']): + projectSourceFiles.append(os.path.join(root, filename)) + + +def CopyrightNames(filename): + names = [] + with open(filename, 'r') as file: + data = file.read() + p = re.compile(ur'\* Copyright.*\d\d\d\d (.*?)\.?$', re.MULTILINE) + names = re.findall(p, data) + return names + + +names = Set() +for file in projectSourceFiles: + copyrightNames = CopyrightNames(file) + for name in copyrightNames: + names.add(name) + +for name in sorted(list(names)): + print(name) -- cgit v0.10.2-6-g49f6