From: Andrei Pavel Date: Thu, 21 Mar 2024 14:34:17 +0000 (+0200) Subject: [#3267] cosmetic changes to find headers script X-Git-Tag: Kea-2.5.7~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=30432f7e8b042d0792a5ef4f0a6619186b57e4da;p=thirdparty%2Fkea.git [#3267] cosmetic changes to find headers script --- diff --git a/tools/find-uninstalled-headers.py b/tools/find-uninstalled-headers.py index f09ea713f8..5963af6e57 100755 --- a/tools/find-uninstalled-headers.py +++ b/tools/find-uninstalled-headers.py @@ -1,19 +1,22 @@ #!/usr/bin/env python3 """ -This script checks that all source headers are installed by inspecting Makefile.am files. +This script checks that all source headers are installed by inspecting +Makefile.am files. -Usage: ./find-uninstalled-headers.py +Usage: ./tools/find-uninstalled-headers.py """ import pathlib import re +import sys + def main(): makefile_ams = sorted(pathlib.Path('./src/lib').glob('**/Makefile.am')) headers = sorted(pathlib.Path('./src/lib').glob('**/*.h')) - headers_pattern = re.compile(r'_HEADERS [\+]{0,1}= (.*\.h|)(.*)') + headers_pattern = re.compile(r'_HEADERS [+]?= (.*\.h|)(.*)') backslash_pattern = re.compile(r'(.*\.h) \\$') failure = False @@ -57,13 +60,15 @@ def main(): for header in headers: if not any(i in header.parts for i in ['tests', 'testutils', 'unittests']): if first: - print('The following headers are not in the _HEADERS section of their respective Makefile.am file:') + print('The following headers are not in the _HEADERS section of ' + 'their respective Makefile.am file:') first = False print(f'- {header}') failure = True if failure: - exit(1) + sys.exit(1) + if __name__ == '__main__': main()