1
0
mirror of https://github.com/ciromattia/kcc synced 2026-05-26 01:12:46 +00:00

makeZIP now prefers 7z for SPEED (#844)

This commit is contained in:
Alex Xu
2025-03-02 11:08:27 -08:00
committed by GitHub
parent ca5c0bdd61
commit e1e6d587f4
3 changed files with 44 additions and 29 deletions

View File

@@ -18,6 +18,7 @@
# PERFORMANCE OF THIS SOFTWARE.
#
from functools import lru_cache
import os
from hashlib import md5
from html.parser import HTMLParser
@@ -137,6 +138,19 @@ def dependencyCheck(level):
print('ERROR: ' + ', '.join(missing) + ' is not installed!')
sys.exit(1)
@lru_cache
def available_archive_tools():
available = []
for tool in ['tar', '7z', 'unar', 'unrar']:
try:
subprocess_run([tool], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
available.append(tool)
except FileNotFoundError:
pass
return available
def subprocess_run(command, **kwargs):
if (os.name == 'nt'):
kwargs.setdefault('creationflags', subprocess.CREATE_NO_WINDOW)