From 1d8a405e8658a95be6ffb6ba81ad7af1c8b8b76f Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Wed, 16 May 2018 15:16:16 +0200 Subject: [PATCH] CURA-5357 Search for license files The old code had the problem that by definition it skipped the `files/` folder and any other dir which of course is where the licenses are. Now, so long as the license is always just called `LICENSE` (which is the convention in open source software), it can be located anywhere. --- cura/CuraPackageManager.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/cura/CuraPackageManager.py b/cura/CuraPackageManager.py index 62ebdb9ff2..0c2c438fcc 100644 --- a/cura/CuraPackageManager.py +++ b/cura/CuraPackageManager.py @@ -338,13 +338,7 @@ class CuraPackageManager(QObject): with zipfile.ZipFile(filename) as archive: # Go through all the files and use the first successful read as the result for file_info in archive.infolist(): - is_dir = lambda file_info: file_info.filename.endswith('/') - if is_dir or not file_info.filename.startswith("files/"): - continue - - filename_parts = os.path.basename(file_info.filename.lower()).split(".") - stripped_filename = filename_parts[0] - if stripped_filename in ("license", "licence"): + if file_info.filename.endswith("LICENSE"): Logger.log("d", "Found potential license file '%s'", file_info.filename) try: with archive.open(file_info.filename, "r") as f: