Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1554 from tokejepsen/2.x/bugfix/delete_old_versions
Browse files Browse the repository at this point in the history
More failsafes prevent errored runs.
  • Loading branch information
mkolar authored May 25, 2021
2 parents f4c6d0a + cae0d83 commit 879dcdb
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pype/plugins/global/load/delete_old_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ def delete_only_repre_files(self, dir_paths, file_paths, delete=True):
os.remove(file_path)
self.log.debug("Removed file: {}".format(file_path))

remainders.remove(file_path_base)
if file_path_base in remainders:
remainders.remove(file_path_base)
continue

seq_path_base = os.path.split(seq_path)[1]
Expand Down Expand Up @@ -419,6 +420,9 @@ def load(self, contexts, name=None, namespace=None, options=None):

data = self.get_data(context, versions_to_keep)

if not data:
continue

size += self.main(data, remove_publish_folder)
print("Progressing {}/{}".format(count + 1, len(contexts)))

Expand Down Expand Up @@ -446,9 +450,6 @@ class CalculateOldVersions(DeleteOldVersions):
def main(self, data, remove_publish_folder):
size = 0

if not data:
return size

if remove_publish_folder:
size = self.delete_whole_dir_paths(
data["dir_paths"].values(), delete=False
Expand Down

0 comments on commit 879dcdb

Please sign in to comment.