Add eyes-thanks, rclone, make python script shorter

This commit is contained in:
doyle 2023-01-31 23:07:01 +11:00
parent 216a0014e3
commit db64b2f37a
3 changed files with 113 additions and 74 deletions

View File

@ -698,7 +698,7 @@ def run(user_app_list,
global devenv_script_buffer global devenv_script_buffer
devenv_script_buffer += "set PATH=%~dp0Symlinks;%PATH%\n" devenv_script_buffer += "set PATH=%~dp0Symlinks;%PATH%\n"
devenv_script_name = "devenv.bat" if IS_WINDOWS else "devenv.sh" devenv_script_name = "dev_env.bat" if IS_WINDOWS else "dev_env.sh"
devenv_script_path = pathlib.Path(install_dir, devenv_script_name) devenv_script_path = pathlib.Path(install_dir, devenv_script_name)
lprint(f"Writing script to augment the environment with installed applications: {devenv_script_path}") lprint(f"Writing script to augment the environment with installed applications: {devenv_script_path}")
with open(devenv_script_path, 'w') as file: with open(devenv_script_path, 'w') as file:

View File

@ -625,7 +625,7 @@ def get_manifest():
version = "1.4.13" version = "1.4.13"
git_hash = "0066c6" git_hash = "0066c6"
result.append({ result.append({
"label": "clink", "label": "Clink",
"manifests": [ "manifests": [
{ {
"download_url": f"https://github.com/chrisant996/clink/releases/download/v{version}/clink.{version}.{git_hash}.zip", "download_url": f"https://github.com/chrisant996/clink/releases/download/v{version}/clink.{version}.{git_hash}.zip",
@ -694,7 +694,7 @@ def get_manifest():
version = "0.37.0" version = "0.37.0"
result.append({ result.append({
"label": "fzf", "label": "FZF",
"manifests": [ "manifests": [
{ {
"download_url": f"https://github.com/junegunn/fzf/releases/download/{version}/fzf-{version}-windows_amd64.zip", "download_url": f"https://github.com/junegunn/fzf/releases/download/{version}/fzf-{version}-windows_amd64.zip",
@ -703,8 +703,8 @@ def get_manifest():
"executables": [ "executables": [
{ {
"path": "fzf.exe", "path": "fzf.exe",
"symlink": [], "symlink": ["fzf.exe"],
"add_to_devenv_path": True, "add_to_devenv_path": False,
"checksum": "c0f4b20d0602977ff3e592cac8eadf86473abed0d24e2def81239bd2e76047e8", "checksum": "c0f4b20d0602977ff3e592cac8eadf86473abed0d24e2def81239bd2e76047e8",
} }
], ],
@ -717,7 +717,7 @@ def get_manifest():
version = "1.1.42" 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",
@ -740,7 +740,7 @@ def get_manifest():
version = "22.02" version = "22.02"
result.append({ result.append({
"label": "mpc-qt", "label": "MPC-Qt",
"manifests": [ "manifests": [
{ {
"download_url": f"https://github.com/mpc-qt/mpc-qt/releases/download/v{version}/mpc-qt-win-x64-{version.replace('.', '')}.zip", "download_url": f"https://github.com/mpc-qt/mpc-qt/releases/download/v{version}/mpc-qt-win-x64-{version.replace('.', '')}.zip",
@ -763,7 +763,7 @@ def get_manifest():
version = "0.8.2" version = "0.8.2"
result.append({ result.append({
"label": "nvim", "label": "NVim",
"manifests": [ "manifests": [
{ {
"download_url": f"https://github.com/neovim/neovim/releases/download/v{version}/nvim-win64.zip", "download_url": f"https://github.com/neovim/neovim/releases/download/v{version}/nvim-win64.zip",
@ -786,7 +786,7 @@ def get_manifest():
version = "0.10.3" version = "0.10.3"
result.append({ result.append({
"label": "neovide", "label": "Neovide",
"manifests": [ "manifests": [
{ {
"download_url": f"https://github.com/neovide/neovide/releases/download/{version}/neovide-windows.zip", "download_url": f"https://github.com/neovide/neovide/releases/download/{version}/neovide-windows.zip",
@ -878,7 +878,7 @@ def get_manifest():
version = "13.0.0" version = "13.0.0"
result.append({ result.append({
"label": "ripgrep", "label": "Ripgrep",
"manifests": [ "manifests": [
{ {
"download_url": f"https://github.com/BurntSushi/ripgrep/releases/download/{version}/ripgrep-{version}-x86_64-pc-windows-msvc.zip", "download_url": f"https://github.com/BurntSushi/ripgrep/releases/download/{version}/ripgrep-{version}-x86_64-pc-windows-msvc.zip",
@ -901,7 +901,7 @@ def get_manifest():
version = "2.0.0" version = "2.0.0"
result.append({ result.append({
"label": "sioyek", "label": "Sioyek",
"manifests": [ "manifests": [
{ {
"download_url": f"https://github.com/ahrm/sioyek/releases/download/v{version}/sioyek-release-windows-portable.zip", "download_url": f"https://github.com/ahrm/sioyek/releases/download/v{version}/sioyek-release-windows-portable.zip",
@ -924,7 +924,7 @@ def get_manifest():
version = "8.6.0" version = "8.6.0"
result.append({ result.append({
"label": "fd", "label": "Fd",
"manifests": [ "manifests": [
{ {
"download_url": f"https://github.com/sharkdp/fd/releases/download/v{version}/fd-v{version}-x86_64-pc-windows-msvc.zip", "download_url": f"https://github.com/sharkdp/fd/releases/download/v{version}/fd-v{version}-x86_64-pc-windows-msvc.zip",
@ -971,4 +971,50 @@ def get_manifest():
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
version = "1.61.1"
result.append({
"label": "RClone",
"manifests": [
{
"download_url": f"https://github.com/rclone/rclone/releases/download/v{version}/rclone-v{version}-windows-amd64.zip",
"download_checksum": "99daaa95867cdf0758ec1d5d7f2ebdb3bf74c8c8602e2aaf888e637163d2ebdd",
"version": version,
"executables": [
{
"path": "rclone.exe",
"symlink": [],
"add_to_devenv_path": False,
"checksum": "e94901809ff7cc5168c1e857d4ac9cbb339ca1f6e21dcce95dfb8e28df799961",
}
],
"add_to_devenv_script": [],
}
],
})
# --------------------------------------------------------------------------
version = "1.5.3"
result.append({
"label": "Eyes-Thanks",
"manifests": [
{
"download_url": f"https://github.com/yalov/eyes-thanks/releases/download/{version}/EyesThanks_v{version}.zip",
"download_checksum": "6ab2b20730f56aa54263eb942be8849f52f9cba26438aee3c1b01103069411cc",
"version": version,
"executables": [
{
"path": "Eyes' Thanks.exe",
"symlink": [],
"add_to_devenv_path": False,
"checksum": "48d232bd4a302b11378791eee844b42a2e30fe3553acf17a3b9e8ee0fcf27766",
}
],
"add_to_devenv_script": [],
}
],
})
# --------------------------------------------------------------------------
return result return result

View File

@ -121,11 +121,11 @@ git_exe = installed_apps["Git"][0]['exe_path']
# Clink # Clink
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
clink_install_dir = installed_apps["clink"][0]['install_dir'] clink_install_dir = installed_apps["Clink"][0]['install_dir']
clink_base_dir = clink_install_dir.parent clink_base_dir = clink_install_dir.parent
# Gizmos # Gizmos
clink_gizmo_git_hash = "fb2edd9" clink_gizmo_git_hash = "fb2edd9"
clink_gizmo_install_dir = clink_base_dir / "clink-gizmos" clink_gizmo_install_dir = clink_base_dir / "clink-gizmos"
git_clone(install_dir=clink_gizmo_install_dir, git_clone(install_dir=clink_gizmo_install_dir,
git_exe=git_exe, git_exe=git_exe,
@ -133,7 +133,7 @@ git_clone(install_dir=clink_gizmo_install_dir,
commit_hash=clink_gizmo_git_hash) commit_hash=clink_gizmo_git_hash)
# Completions # Completions
clink_completions_git_hash = "86b6f07" clink_completions_git_hash = "86b6f07"
clink_completions_install_dir = clink_base_dir / "clink-completions" clink_completions_install_dir = clink_base_dir / "clink-completions"
git_clone(install_dir=clink_completions_install_dir, git_clone(install_dir=clink_completions_install_dir,
git_exe=git_exe, git_exe=git_exe,
@ -161,8 +161,8 @@ git_clone(install_dir=odin_install_dir,
devenver.print_header("Install configuration files") devenver.print_header("Install configuration files")
# Copy init.vim to NVIM directory # Copy init.vim to NVIM directory
internal_dir = pathlib.Path(os.path.dirname(os.path.abspath(__file__)), "Internal") internal_dir = pathlib.Path(os.path.dirname(os.path.abspath(__file__))) / "Internal"
nvim_init_dir = pathlib.Path(os.path.expanduser("~"), "AppData", "Local", "nvim") nvim_init_dir = pathlib.Path(os.path.expanduser("~")) / "AppData" / "Local" / "nvim"
nvim_config_dest_path = nvim_init_dir / "init.vim" nvim_config_dest_path = nvim_init_dir / "init.vim"
nvim_config_src_path = internal_dir / "os_nvim_init.vim" nvim_config_src_path = internal_dir / "os_nvim_init.vim"
@ -181,11 +181,12 @@ if not os.path.exists(nvim_plug_vim_path):
# Install clink configuration # Install clink configuration
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
clink_profile_dir = clink_base_dir / "profile" clink_profile_dir = clink_base_dir / "profile"
clink_settings_path = clink_profile_dir / "clink_settings" clink_settings_path = clink_profile_dir / "clink_settings"
clink_settings = f""" devenver.lprint(f"Installing clink_settings to: {clink_settings_path}")
# When this file is named "default_settings" and is in the binaries
clink_settings_path.parent.mkdir(exist_ok=True)
clink_settings_path.write_text(f"""# When this file is named "default_settings" and is in the binaries
# directory or profile directory, it provides enhanced default settings. # directory or profile directory, it provides enhanced default settings.
# Override built-in default settings with ones that provide a more # Override built-in default settings with ones that provide a more
@ -221,26 +222,18 @@ match.substring = True
clink.path = {clink_completions_install_dir};{clink_gizmo_install_dir} clink.path = {clink_completions_install_dir};{clink_gizmo_install_dir}
fzf.default_bindings = True fzf.default_bindings = True
""" """)
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:
file.write(clink_settings)
# Install wezterm configuration # Install wezterm configuration
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
wezterm_install_dir = installed_apps["WezTerm"][0]["install_dir"] wezterm_config_dest_path = installed_apps["WezTerm"][0]["install_dir"] / "wezterm.lua"
wezterm_exe_path = installed_apps["WezTerm"][0]["exe_path"]
wezterm_config_dest_path = wezterm_install_dir / "wezterm.lua"
devenver.lprint(f"Installing WezTerm config to {wezterm_config_dest_path}") devenver.lprint(f"Installing WezTerm config to {wezterm_config_dest_path}")
clink_exe_path = clink_install_dir.relative_to(install_dir) / "clink_x64.exe" clink_exe_path = clink_install_dir.relative_to(install_dir) / "clink_x64.exe"
clink_exe_path_for_wezterm = str(clink_exe_path).replace("\\", "\\\\") clink_exe_path_for_wezterm = str(clink_exe_path).replace("\\", "\\\\")
clink_profile_path_for_wezterm = str(clink_profile_dir.relative_to(install_dir)).replace("\\", "\\\\") clink_profile_path_for_wezterm = str(clink_profile_dir.relative_to(install_dir)).replace("\\", "\\\\")
wezterm_lua_buffer = f"""local wezterm = require 'wezterm'; wezterm_config_dest_path.write_text(f"""local wezterm = require 'wezterm';
local default_prog local default_prog
local set_environment_variables = {{}} local set_environment_variables = {{}}
@ -248,7 +241,7 @@ local set_environment_variables = {{}}
if wezterm.target_triple == "x86_64-pc-windows-msvc" then 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\\\\..\\\\..\\\\dev_env.bat", wezterm.executable_dir)
msvc_bat = string.format("%s\\\\..\\\\..\\\\msvc\\\\msvc-{msvc_version}.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) 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)
@ -271,15 +264,14 @@ return {{
default_prog = default_prog, default_prog = default_prog,
set_environment_variables = set_environment_variables, set_environment_variables = set_environment_variables,
}} }}
""" """)
with open(wezterm_config_dest_path, "w") as file:
file.write(wezterm_lua_buffer)
# Wezterm super terminal # Wezterm super terminal
wezterm_exe_rel_path = pathlib.Path(wezterm_exe_path).relative_to(install_dir) # ------------------------------------------------------------------------------
wezterm_terminal_script_path = pathlib.Path(install_dir, "win_terminal.bat") wezterm_terminal_script_path = install_dir / "dev_terminal.bat"
wezterm_terminal_script = f"""@echo off devenver.lprint(f"Installing WezTerm terminal script to {wezterm_terminal_script_path}")
wezterm_terminal_script_path.write_text(f"""@echo off
setlocal EnableDelayedExpansion setlocal EnableDelayedExpansion
set working_dir= set working_dir=
@ -288,16 +280,18 @@ if "%~1" neq "" (
set working_dir=!working_dir:\=/! set working_dir=!working_dir:\=/!
) )
call \"{msvc_install_dir}\\msvc-{msvc_version}.bat\" start "" /MAX "%~dp0{installed_apps["WezTerm"][0]["exe_path"].relative_to(install_dir)}" !working_dir!
call \"{msvc_install_dir}\\win-sdk-{win10_sdk_version}.bat\" """)
if exist "%~dp0win_terminal_user_config.bat" call "%~dp0win_terminal_user_config.bat" # Run background scripts helper
start "" /MAX "%~dp0{wezterm_exe_rel_path}" !working_dir! # ------------------------------------------------------------------------------
""" background_apps_script_path = pathlib.Path(install_dir, "dev_run_background_apps.bat")
devenver.lprint(f"Installing run background script (helper) to {background_apps_script_path}")
devenver.lprint(f"Installing WezTerm terminal script to {wezterm_terminal_script_path}") background_apps_script_path.write_text(f"""@echo off
with open(wezterm_terminal_script_path, "w") as file: start "" "%~dp0{installed_apps["Everything"][0]["exe_path"].relative_to(install_dir)}"
file.write(wezterm_terminal_script) start "" "%~dp0{installed_apps["Eyes-Thanks"][0]["exe_path"].relative_to(install_dir)}"
""")
# Create Odin work-around scripts # Create Odin work-around scripts
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
@ -305,17 +299,6 @@ with open(wezterm_terminal_script_path, "w") as file:
# registry. Here we inject the registry entry that the SDK locator checks for # registry. Here we inject the registry entry that the SDK locator checks for
# finding our portable MSVC installation. # finding our portable MSVC installation.
win10_sdk_find_test_dir_reg_path = str(win10_sdk_find_test_dir).replace("\\", "\\\\") win10_sdk_find_test_dir_reg_path = str(win10_sdk_find_test_dir).replace("\\", "\\\\")
odin_msvc_install_script = f"""Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows Kits\Installed Roots]
"KitsRoot10"="{win10_sdk_find_test_dir_reg_path}"
"""
odin_msvc_uninstall_script = f"""Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows Kits\Installed Roots]
"KitsRoot10"=-
"""
odin_msvc_install_script_path = install_dir / "odin_msvc_install_workaround.reg" odin_msvc_install_script_path = install_dir / "odin_msvc_install_workaround.reg"
odin_msvc_uninstall_script_path = install_dir / "odin_msvc_uninstall_workaround.reg" odin_msvc_uninstall_script_path = install_dir / "odin_msvc_uninstall_workaround.reg"
@ -324,27 +307,37 @@ devenver.lprint(f"Installing Odin MSVC workaround scripts", level=0)
devenver.lprint(f" - {odin_msvc_install_script_path}", level=1) devenver.lprint(f" - {odin_msvc_install_script_path}", level=1)
devenver.lprint(f" - {odin_msvc_uninstall_script_path}", level=1) devenver.lprint(f" - {odin_msvc_uninstall_script_path}", level=1)
with open(odin_msvc_install_script_path, "w") as file: odin_msvc_install_script_path.write_text(f"""Windows Registry Editor Version 5.00
file.write(odin_msvc_install_script)
with open(odin_msvc_uninstall_script_path, "w") as file: [HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows Kits\Installed Roots]
file.write(odin_msvc_uninstall_script) "KitsRoot10"="{win10_sdk_find_test_dir_reg_path}"
""")
# Add python-update bootstrap script odin_msvc_uninstall_script_path.write_text(f"""Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows Kits\Installed Roots]
"KitsRoot10"=-
""")
# Python
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# TODO: If I'm using the terminal that this script generates it will lock the # TODO: If I'm using the terminal that this script generates it will lock the
# executable and Python cannot open the file for verifying the SHA256. # executable and Python cannot open the file for verifying the SHA256.
python_exe = pathlib.Path(installed_apps["Python"][0]['exe_path']).relative_to(install_dir) python_exe_path = pathlib.Path(installed_apps["Python"][0]['exe_path'])
python_install_dir = pathlib.Path(installed_apps["Python"][0]['exe_path']).parent.relative_to(install_dir)
# PyNvim
devenver.lprint(f"Installing PyNVIM")
subprocess.run(f"{python_exe_path} -m pip install pynvim")
# Add update script
python_rel_exe_path = pathlib.Path(python_exe_path).relative_to(install_dir)
python_install_dir = pathlib.Path(python_exe_path).parent.relative_to(install_dir)
win_setup_script_path = pathlib.Path(devenver.script_dir, "win_install.py") win_setup_script_path = pathlib.Path(devenver.script_dir, "win_install.py")
bootstrap_setup_script = f"""@echo off (install_dir / "dev_env_update.bat").write_text(f"""@echo off
setlocal EnableDelayedExpansion setlocal EnableDelayedExpansion
set PYTHONHOME=%~dp0{python_install_dir} set PYTHONHOME=%~dp0{python_install_dir}
%~dp0{python_exe} {win_setup_script_path} %~dp0{python_rel_exe_path} {win_setup_script_path}
pause pause
""" """)
with open(install_dir / "upgrade_bootstrap.bat", "w") as file:
file.write(bootstrap_setup_script)