From 0d52b53172ed001e70730f21b021e71f51bbb18c Mon Sep 17 00:00:00 2001 From: tretrauit Date: Tue, 20 Jun 2023 18:51:02 +0700 Subject: [PATCH] xdelta3: delete archive file after extract --- vollerei/utils/xdelta3/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vollerei/utils/xdelta3/__init__.py b/vollerei/utils/xdelta3/__init__.py index cbe8af3..d342b6e 100644 --- a/vollerei/utils/xdelta3/__init__.py +++ b/vollerei/utils/xdelta3/__init__.py @@ -60,12 +60,14 @@ class Xdelta3: url = "https://github.com/jmacd/xdelta-gpl/releases/download/v3.1.0/xdelta3-3.1.0-i686.exe.zip" case "i686": url = "https://github.com/jmacd/xdelta-gpl/releases/download/v3.1.0/xdelta3-3.1.0-i686.exe.zip" + file = self._xdelta3_path.joinpath("xdelta3.zip") with requests.get(url, stream=True) as r: - with open(self._xdelta3_path.joinpath("xdelta3.zip"), "wb") as f: + with open(file, "wb") as f: for chunk in r.iter_content(chunk_size=32768): f.write(chunk) - with ZipFile(self._xdelta3_path.joinpath("xdelta3.zip")) as z: + with ZipFile(file) as z: z.extractall(self._xdelta3_path) + file.unlink() def patch_file(self, patch: PathLike, target: PathLike, output: PathLike): """