From eb9bcf0adadce8b3ed74bd5bd8e4cc1ceae30169 Mon Sep 17 00:00:00 2001 From: Chris Palmer Date: Sun, 15 Nov 2020 16:29:50 +0000 Subject: [PATCH] Fixed recent bug in plateup when no platters / panels. --- scripts/plateup.py | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/scripts/plateup.py b/scripts/plateup.py index 797c097..46594cd 100644 --- a/scripts/plateup.py +++ b/scripts/plateup.py @@ -87,24 +87,25 @@ def plateup(target, part_type, usage = None): match = re.match(r'^ECHO: "~(.*?\.' + part_type + r').*"$', line) if match: used.append(match.group(1)) - # - # Copy file that are not included - # copied = [] - for file in os.listdir(parts_dir): - if file.endswith('.' + part_type) and not file in used: - src = parts_dir + '/' + file - dst = target_dir + '/' + file - if mtime(src) > mtime(dst): - print("Copying %s to %s" % (src, dst)) - copyfile(src, dst) - copied.append(file) - # - # Remove any cruft - # - targets = [file[:-4] + part_type for file in all_sources] - for file in os.listdir(target_dir): - if file.endswith('.' + part_type): - if not file in targets and not file in copied: - print("Removing %s" % file) - os.remove(target_dir + '/' + file) + if all_sources: + # + # Copy files that are not included + # + for file in os.listdir(parts_dir): + if file.endswith('.' + part_type) and not file in used: + src = parts_dir + '/' + file + dst = target_dir + '/' + file + if mtime(src) > mtime(dst): + print("Copying %s to %s" % (src, dst)) + copyfile(src, dst) + copied.append(file) + # + # Remove any cruft + # + targets = [file[:-4] + part_type for file in all_sources] + for file in os.listdir(target_dir): + if file.endswith('.' + part_type): + if not file in targets and not file in copied: + print("Removing %s" % file) + os.remove(target_dir + '/' + file)