From 53612738f6a985c2c3fb0eafedcaecf73afb5231 Mon Sep 17 00:00:00 2001 From: Patrick McCarty Date: Mon, 17 Aug 2020 20:50:27 -0700 Subject: [PATCH] Expand license file search to LICENSES/*.txt The KDE Project is starting to adopt a convention to add license files, with a .txt file extension, to a toplevel directory called "LICENSES". Make autospec learn about this convention. Signed-off-by: Patrick McCarty --- autospec/license.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/autospec/license.py b/autospec/license.py index b129878..27bd3b0 100644 --- a/autospec/license.py +++ b/autospec/license.py @@ -169,6 +169,11 @@ def scan_for_licenses(srcdir, config, pkg_name): if name.lower() in targets or target_pat.search(name.lower()): license_from_copying_hash(os.path.join(dirpath, name), srcdir, config, pkg_name) + # Also look for files that end with .txt and reside in a LICENSES + # directory. This is a convention that KDE is adopting. + if os.path.basename(dirpath) == "LICENSES" and re.search(r'\.txt$', name): + license_from_copying_hash(os.path.join(dirpath, name), + srcdir, config, pkg_name) if not licenses: print_fatal(" Cannot find any license or a valid {}.license file!\n".format(pkg_name))