in aws_lambda_builders/actions.py [0:0]
def execute(self):
if not os.path.isdir(self.target_dir):
LOG.debug("Clean up action: %s does not exist and will be skipped.", str(self.target_dir))
return
targets = os.listdir(self.target_dir)
LOG.debug("Clean up action: folder %s will be cleaned", str(self.target_dir))
for name in targets:
target_path = os.path.join(self.target_dir, name)
LOG.debug("Clean up action: %s is deleted", str(target_path))
if os.path.islink(target_path):
os.unlink(target_path)
elif os.path.isdir(target_path):
shutil.rmtree(target_path)
else:
os.remove(target_path)