Fixed recent bug in plateup when no platters / panels.

This commit is contained in:
Chris Palmer 2020-11-15 16:29:50 +00:00
parent fc7fd5482e
commit eb9bcf0ada
1 changed files with 21 additions and 20 deletions

View File

@ -87,24 +87,25 @@ def plateup(target, part_type, usage = None):
match = re.match(r'^ECHO: "~(.*?\.' + part_type + r').*"$', line) match = re.match(r'^ECHO: "~(.*?\.' + part_type + r').*"$', line)
if match: if match:
used.append(match.group(1)) used.append(match.group(1))
#
# Copy file that are not included
#
copied = [] copied = []
for file in os.listdir(parts_dir): if all_sources:
if file.endswith('.' + part_type) and not file in used: #
src = parts_dir + '/' + file # Copy files that are not included
dst = target_dir + '/' + file #
if mtime(src) > mtime(dst): for file in os.listdir(parts_dir):
print("Copying %s to %s" % (src, dst)) if file.endswith('.' + part_type) and not file in used:
copyfile(src, dst) src = parts_dir + '/' + file
copied.append(file) dst = target_dir + '/' + file
# if mtime(src) > mtime(dst):
# Remove any cruft print("Copying %s to %s" % (src, dst))
# copyfile(src, dst)
targets = [file[:-4] + part_type for file in all_sources] copied.append(file)
for file in os.listdir(target_dir): #
if file.endswith('.' + part_type): # Remove any cruft
if not file in targets and not file in copied: #
print("Removing %s" % file) targets = [file[:-4] + part_type for file in all_sources]
os.remove(target_dir + '/' + file) 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)