Support tools with multiple architectures

This commit is contained in:
2Shirt 2021-05-05 23:10:38 -06:00
parent acc3a4dccc
commit 4872a18e91
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
2 changed files with 10 additions and 6 deletions

View file

@ -63,6 +63,7 @@ def download_file(out_path, source_url, as_new=False, overwrite=False):
def download_tool(folder, name):
"""Download tool."""
name_arch = f'{name}{ARCH}'
out_path = find_kit_dir('.bin').joinpath(f'{folder}/{name}.exe')
up_to_date = False
@ -77,9 +78,15 @@ def download_tool(folder, name):
LOG.info('Skip downloading up-to-date tool: %s', name)
return
# Get ARCH specific URL if available
if name_arch in SOURCES:
source_url = SOURCES[name_arch]
out_path = out_path.with_stem(name_arch)
else:
source_url = SOURCES[name]
# Download
LOG.info('Downloading tool: %s', name)
source_url = SOURCES[name]
try:
new_file = download_file(out_path, source_url, as_new=True)
new_file.replace(out_path)

View file

@ -20,7 +20,7 @@ from wk.exe import (
wait_for_procs,
)
from wk.io import delete_folder, rename_item
from wk.kit.tools import ARCH, download_tool, get_tool_path, run_tool
from wk.kit.tools import download_tool, get_tool_path, run_tool
from wk.log import format_log_path, update_log_path
from wk.os.win import (
reg_delete_value,
@ -817,10 +817,7 @@ def run_hitmanpro():
log_path = log_path.with_suffix('.xml')
log_path.parent.mkdir(parents=True, exist_ok=True)
cmd_args = ['/scanonly', f'/log={log_path}']
run_tool(
'HitmanPro', f'HitmanPro{"64" if ARCH=="64" else ""}',
*cmd_args, download=True,
)
run_tool('HitmanPro', 'HitmanPro', *cmd_args, download=True)
def run_iobit_uninstaller():