remove copied zip from version repository after extraction

This commit is contained in:
Jakub Trllo 2022-04-22 11:35:50 +02:00
parent 4bae7484fa
commit fc73f253b2

View file

@ -1405,6 +1405,7 @@ class BootstrapRepos:
# create destination parent directories even if they don't exist.
destination.mkdir(parents=True)
remove_source_file = False
# version is directory
if openpype_version.path.is_dir():
# create zip inside temporary directory.
@ -1438,6 +1439,8 @@ class BootstrapRepos:
self._progress_callback(35)
openpype_version.path = self._copy_zip(
openpype_version.path, destination)
# Mark zip to be deleted when done
remove_source_file = True
# extract zip there
self._print("extracting zip to destination ...")
@ -1446,6 +1449,10 @@ class BootstrapRepos:
zip_ref.extractall(destination)
self._progress_callback(100)
# Remove zip file copied to local app data
if remove_source_file:
os.remove(openpype_version.path)
return destination
def _copy_zip(self, source: Path, destination: Path) -> Path: