|
34 | 34 | # NOTE: the size of `chunk_to_emit` should in theory contain everything that above regexes capture |
35 | 35 | _DEFAULT_CHUNK_SIZE: Final[NonNegativeInt] = 20 |
36 | 36 |
|
| 37 | +_7ZIP_PATH: Final[Path] = Path("/usr/bin/7z") |
| 38 | + |
37 | 39 |
|
38 | 40 | class ArchiveInfoParser: |
39 | 41 | def __init__(self) -> None: |
@@ -124,6 +126,7 @@ async def _output_reader( |
124 | 126 |
|
125 | 127 | lookbehind_buffer = "" # store the last chunk |
126 | 128 |
|
| 129 | + # TODO: rewrite the scrolling window to be a bit longer so that we could capture bigger numbers |
127 | 130 | while True: |
128 | 131 | read_chunk = await stream.read(chunk_size) |
129 | 132 | if not read_chunk: |
@@ -204,7 +207,7 @@ async def archive_dir( |
204 | 207 | "-mta=off", # Don't store file access time |
205 | 208 | ] |
206 | 209 | ) |
207 | | - command = f"7z {options} {destination} {dir_to_compress}/*" |
| 210 | + command = f"{_7ZIP_PATH} {options} {destination} {dir_to_compress}/*" |
208 | 211 |
|
209 | 212 | folder_size_bytes = sum( |
210 | 213 | file.stat().st_size for file in iter_files_to_compress(dir_to_compress) |
@@ -252,7 +255,7 @@ async def unarchive_dir( |
252 | 255 | # get archive information |
253 | 256 | archive_info_parser = ArchiveInfoParser() |
254 | 257 | await _run_cli_command( |
255 | | - f"7z l {archive_to_extract}", |
| 258 | + f"{_7ZIP_PATH} l {archive_to_extract}", |
256 | 259 | output_handlers=[archive_info_parser.parse_chunk], |
257 | 260 | ) |
258 | 261 | total_bytes, file_count = archive_info_parser.get_parsed_values() |
@@ -286,7 +289,7 @@ async def progress_handler(byte_progress: NonNegativeInt) -> None: |
286 | 289 | ] |
287 | 290 | ) |
288 | 291 | await _run_cli_command( |
289 | | - f"7z {options} {archive_to_extract} -o{destination_folder}", |
| 292 | + f"{_7ZIP_PATH} {options} {archive_to_extract} -o{destination_folder}", |
290 | 293 | output_handlers=[ProgressParser(progress_handler).parse_chunk], |
291 | 294 | ) |
292 | 295 |
|
|
0 commit comments