diff --git a/pype/plugins/global/publish/cleanup.py b/pype/plugins/global/publish/cleanup.py index 3bb9ddc144..68ec9a48ad 100644 --- a/pype/plugins/global/publish/cleanup.py +++ b/pype/plugins/global/publish/cleanup.py @@ -16,21 +16,21 @@ class CleanUp(pyblish.api.InstancePlugin): exclude_families = ["clip"] def process(self, instance): - # if [ef for ef in self.exclude_families - # if instance.data["family"] in ef]: - # return - # import tempfile - # - # staging_dir = instance.data.get("stagingDir", None) - # if not staging_dir or not os.path.exists(staging_dir): - # self.log.info("No staging directory found: %s" % staging_dir) - # return - # - # temp_root = tempfile.gettempdir() - # if not os.path.normpath(staging_dir).startswith(temp_root): - # self.log.info("Skipping cleanup. Staging directory is not in the " - # "temp folder: %s" % staging_dir) - # return - # - # self.log.info("Removing temporary folder ...") - # shutil.rmtree(staging_dir) + if [ef for ef in self.exclude_families + if instance.data["family"] in ef]: + return + import tempfile + + staging_dir = instance.data.get("stagingDir", None) + if not staging_dir or not os.path.exists(staging_dir): + self.log.info("No staging directory found: %s" % staging_dir) + return + + temp_root = tempfile.gettempdir() + if not os.path.normpath(staging_dir).startswith(temp_root): + self.log.info("Skipping cleanup. Staging directory is not in the " + "temp folder: %s" % staging_dir) + return + + self.log.info("Removing temporary folder ...") + shutil.rmtree(staging_dir)