diff --git a/umu/umu_bspatch.py b/umu/umu_bspatch.py index 13fe60f5..68d7c8f4 100644 --- a/umu/umu_bspatch.py +++ b/umu/umu_bspatch.py @@ -115,7 +115,12 @@ def __init__( # noqa: D107 self._arc_manifest: list[ManifestEntry] = self._arc_contents["manifest"] self._compat_tool = compat_tool self._thread_pool = thread_pool - self._futures: list[Future] = [] + # Collection where each task creates a new file within an existing compatibility tool + self._add: list[Future] = [] + # Collection where each task updates an existing file + self._update: list[Future] = [] + # Collection where each task verifies an existing file + self._verify: list[Future] = [] def add_binaries(self) -> None: """Add binaries within a compatibility tool. @@ -131,7 +136,7 @@ def add_binaries(self) -> None: build_file: Path = self._compat_tool.joinpath(item["name"]) if item["type"] == FileType.File.value: # Decompress the zstd data and write the file - self._futures.append( + self._add.append( self._thread_pool.submit(self._write_proton_file, build_file, item) ) continue @@ -160,7 +165,7 @@ def update_binaries(self) -> None: build_file: Path = self._compat_tool.joinpath(item["name"]) if item["type"] == FileType.File.value: # For files, apply a binary patch - self._futures.append( + self._update.append( self._thread_pool.submit(self._patch_proton_file, build_file, item) ) continue @@ -209,13 +214,13 @@ def delete_binaries(self) -> None: def verify_integrity(self) -> None: """Verify the expected mode, size, file and digest of the compatibility tool.""" for item in self._arc_manifest: - self._futures.append( + self._verify.append( self._thread_pool.submit(self._check_binaries, self._compat_tool, item) ) - def result(self) -> list[Future]: - """Return the currently submitted tasks.""" - return self._futures + def result(self) -> tuple[list[Future], list[Future], list[Future]]: + """Return all the currently submitted tasks.""" + return (self._verify, self._add, self._update) def _check_binaries(self, proton: Path, item: ManifestEntry) -> ManifestEntry: rpath: Path = proton.joinpath(item["name"])