Fix various bugs

This commit is contained in:
doyle 2023-01-30 13:08:20 +11:00
parent 3c304cf91a
commit 5a7febd0ba
4 changed files with 24 additions and 12 deletions

View File

@ -187,7 +187,7 @@ def download_file_at_url(url, download_path, download_checksum, label):
# Download the file from URL # Download the file from URL
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
if file_already_downloaded == False: if file_already_downloaded == False:
lprint('Initiating download request ...', level=1) lprint('Initiating download request ...', level=2)
with urllib.request.urlopen(url) as response: with urllib.request.urlopen(url) as response:
temp_file = tempfile.mkstemp(text=False) temp_file = tempfile.mkstemp(text=False)
temp_file_handle = temp_file[0] temp_file_handle = temp_file[0]
@ -204,12 +204,12 @@ def download_file_at_url(url, download_path, download_checksum, label):
bytes_downloaded += bytes_written bytes_downloaded += bytes_written
percent_downloaded = int(bytes_downloaded / total_download_size * 100) percent_downloaded = int(bytes_downloaded / total_download_size * 100)
lprint(' ' * len(line), end='\r', level=1) lprint(' ' * len(line), end='\r', level=2)
line = f'Downloading {percent_downloaded:.2f}% ({bytes_downloaded}/{total_download_size})' line = f'Downloading {percent_downloaded:.2f}% ({bytes_downloaded}/{total_download_size})'
lprint(line, end='\r', level=1) lprint(line, end='\r', level=2)
except Exception as exception: except Exception as exception:
download_failed = True download_failed = True
lprint(f'Download {label} from {url} failed, {exception}', level=1) lprint(f'Download {label} from {url} failed, {exception}', level=2)
finally: finally:
temp_file_io.close() temp_file_io.close()
print() print()

View File

@ -715,20 +715,20 @@ def get_manifest():
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
version = "1.1.41.1" version = "1.1.42"
result.append({ result.append({
"label": "jpegview", "label": "jpegview",
"manifests": [ "manifests": [
{ {
"download_url": f"https://github.com/sylikc/jpegview/releases/download/v{version}/JPEGView_{version}.7z", "download_url": f"https://github.com/sylikc/jpegview/releases/download/v{version}/JPEGView_{version}.7z",
"download_checksum": "7dd4b4b34b14e5fae331c7f4ebfb658be6684c70ec055cb1964642a8b45e4886", "download_checksum": "84b20a6f3ee5184176e46a6755a57147aba90984c2fbbee094e57af036859daf",
"version": version, "version": version,
"executables": [ "executables": [
{ {
"path": "JPEGView64/JPEGView.exe", "path": "JPEGView64/JPEGView.exe",
"symlink": [], "symlink": [],
"add_to_devenv_path": False, "add_to_devenv_path": False,
"checksum": "f4fe2308c932a5f4f41f67b0520fe1fe8a96c94169d98c83f9501e9dc84b56ad", "checksum": "cd7930d0242cbd8a0d0dc9861e48f6ebe4c2bfba33aafbcf8e0da497ab0eae54",
} }
], ],
"add_to_devenv_script": [], "add_to_devenv_script": [],
@ -743,7 +743,7 @@ def get_manifest():
"label": "mpc-qt", "label": "mpc-qt",
"manifests": [ "manifests": [
{ {
"download_url": f"https://github.com/sylikc/jpegview/releases/download/v{version}/JPEGView_{version}.7z", "download_url": f"https://github.com/mpc-qt/mpc-qt/releases/download/v{version}/mpc-qt-win-x64-{version.replace('.', '')}.zip",
"download_checksum": "2230c4f4de1a429ccc67e5c590efc0a86fbaffeb33a4dc5f391aa45e660b80c2", "download_checksum": "2230c4f4de1a429ccc67e5c590efc0a86fbaffeb33a4dc5f391aa45e660b80c2",
"version": version, "version": version,
"executables": [ "executables": [

View File

@ -9,6 +9,10 @@
# folders, skip the downloading of MSVC or the SDK if we only need one of them). # folders, skip the downloading of MSVC or the SDK if we only need one of them).
# #
# Changelog # Changelog
# 2023-01-30
# - Generate the short-hand version of the msvc-{version}.bat and
# win-sdk-{version}.bat using the versions passed as the argument parameter.
#
# 2023-01-28 # 2023-01-28
# - Inital revision from mmozeiko # - Inital revision from mmozeiko
# https://gist.github.com/mmozeiko/7f3162ec2988e81e56d5c4e22cde9977/6863f19cb98b933c7535acf3d59ac64268c6bd1b # https://gist.github.com/mmozeiko/7f3162ec2988e81e56d5c4e22cde9977/6863f19cb98b933c7535acf3d59ac64268c6bd1b
@ -352,6 +356,7 @@ set INCLUDE=%MSVC_ROOT%\\include;%INCLUDE%
set LIB=%MSVC_ROOT%\\lib\\%MSVC_ARCH%;%LIB% set LIB=%MSVC_ROOT%\\lib\\%MSVC_ARCH%;%LIB%
""" """
(OUTPUT / f"msvc-{msvcv}.bat").write_text(MSVC_SCRIPT) (OUTPUT / f"msvc-{msvcv}.bat").write_text(MSVC_SCRIPT)
(OUTPUT / f"msvc-{args.msvc_version}.bat").write_text(MSVC_SCRIPT)
if install_sdk: if install_sdk:
WIN10_SDK_SCRIPT = f"""@echo off WIN10_SDK_SCRIPT = f"""@echo off
@ -366,6 +371,7 @@ set INCLUDE=%SDK_INCLUDE%\\ucrt;%SDK_INCLUDE%\\shared;%SDK_INCLUDE%\\um;%SDK_INC
set LIB=%SDK_LIBS%\\ucrt\\%SDK_ARCH%;%SDK_LIBS%\\um\\%SDK_ARCH% set LIB=%SDK_LIBS%\\ucrt\\%SDK_ARCH%;%SDK_LIBS%\\um\\%SDK_ARCH%
""" """
(OUTPUT / f"win-sdk-{sdkv}.bat").write_text(WIN10_SDK_SCRIPT) (OUTPUT / f"win-sdk-{sdkv}.bat").write_text(WIN10_SDK_SCRIPT)
(OUTPUT / f"win-sdk-{args.sdk_version}.bat").write_text(WIN10_SDK_SCRIPT)
print(f"Total downloaded: {total_download>>20} MB") print(f"Total downloaded: {total_download>>20} MB")
print("Done!") print("Done!")

View File

@ -74,7 +74,7 @@ if msvc_installed == False or win10_sdk_installed == False:
with tempfile.TemporaryDirectory() as temp_dir: with tempfile.TemporaryDirectory() as temp_dir:
# Invoke the MSVC script to download MSVC to disk # Invoke the MSVC script to download MSVC to disk
command = f"'{sys.executable}' '{msvc_script}' --accept-license" command = f"\"{sys.executable}\" \"{msvc_script}\" --accept-license"
line = "Invoking MSVC script to install" line = "Invoking MSVC script to install"
if msvc_installed: if msvc_installed:
command += " --no-msvc" command += " --no-msvc"
@ -218,7 +218,8 @@ clink.path = {clink_completions_install_dir};{clink_gizmo
fzf.default_bindings = True fzf.default_bindings = True
""" """
devenver.lprint("Installing clink_settings to: {clink_settings_path}") devenver.lprint(f"Installing clink_settings to: {clink_settings_path}")
clink_settings_path.parent.mkdir(exist_ok=True)
with open(clink_settings_path, "w+") as file: with open(clink_settings_path, "w+") as file:
file.write(clink_settings) file.write(clink_settings)
@ -243,7 +244,8 @@ if wezterm.target_triple == "x86_64-pc-windows-msvc" then
clink_exe = string.format("%s\\\\..\\\\..\\\\{clink_exe_path_for_wezterm}", wezterm.executable_dir) clink_exe = string.format("%s\\\\..\\\\..\\\\{clink_exe_path_for_wezterm}", wezterm.executable_dir)
devenv_bat = string.format("%s\\\\..\\\\..\\\\devenv.bat", wezterm.executable_dir) devenv_bat = string.format("%s\\\\..\\\\..\\\\devenv.bat", wezterm.executable_dir)
msvc_bat = string.format("%s\\\\..\\\\..\\\\msvc\\\\setup.bat", wezterm.executable_dir) msvc_bat = string.format("%s\\\\..\\\\..\\\\msvc\\\\msvc-{msvc_version}.bat", wezterm.executable_dir)
win10_sdk_bat = string.format("%s\\\\..\\\\..\\\\msvc\\\\win-sdk-{win10_sdk_version}.bat", wezterm.executable_dir)
clink_profile = string.format("%s\\\\..\\\\..\\\\{clink_profile_path_for_wezterm}", wezterm.executable_dir) clink_profile = string.format("%s\\\\..\\\\..\\\\{clink_profile_path_for_wezterm}", wezterm.executable_dir)
-- Taken from: https://wezfurlong.org/wezterm/shell-integration.html -- Taken from: https://wezfurlong.org/wezterm/shell-integration.html
@ -254,7 +256,8 @@ if wezterm.target_triple == "x86_64-pc-windows-msvc" then
default_prog = {{"cmd.exe", "/s", "/k", default_prog = {{"cmd.exe", "/s", "/k",
clink_exe, "inject", "--profile", clink_profile, "-q", clink_exe, "inject", "--profile", clink_profile, "-q",
"&&", "call", devenv_bat, "&&", "call", devenv_bat,
"&&", "call", msvc_bat}} "&&", "call", msvc_bat,
"&&", "call", win10_sdk_bat}}
end end
return {{ return {{
@ -280,6 +283,9 @@ if "%~1" neq "" (
set working_dir=!working_dir:\=/! set working_dir=!working_dir:\=/!
) )
call \"{msvc_install_dir}\\msvc-{msvc_version}.bat\"
call \"{msvc_install_dir}\\win-sdk-{win10_sdk_version}.bat\"
if exist "%~dp0win_terminal_user_config.bat" call "%~dp0win_terminal_user_config.bat" if exist "%~dp0win_terminal_user_config.bat" call "%~dp0win_terminal_user_config.bat"
start "" /MAX "%~dp0{wezterm_exe_rel_path}" !working_dir! start "" /MAX "%~dp0{wezterm_exe_rel_path}" !working_dir!
""" """