This commit is contained in:
2026-02-14 12:09:19 +11:00
parent c35d7b01f7
commit 8934927e9d
9 changed files with 6 additions and 463 deletions
+1 -64
View File
@@ -8,9 +8,7 @@ import shutil
import tempfile
import argparse
import urllib.request
import app_manifest_dev
import app_manifest_user
def git_clone(install_dir, git_exe, url, commit_hash):
devenver.lprint(f"Git clone {url} to {install_dir}", level=0)
@@ -78,7 +76,6 @@ if install_dir == pathlib.Path(""):
# ------------------------------------------------------------------------------
if args.with_dev_apps:
# Run DEVenver, installing the portable apps
# --------------------------------------------------------------------------
dev_env_script_name = "dev_env"
app_list = app_manifest_dev.get_manifest(is_windows=is_windows)
installed_dev_apps = devenver.run(user_app_list=app_list,
@@ -91,12 +88,10 @@ if args.with_dev_apps:
install_script_path = pathlib.Path(devenver.script_dir, "install.py")
if is_windows:
# Install apps dependent on Git
# --------------------------------------------------------------------------
devenver.print_header("Install apps that rely on Git")
git_exe = installed_dev_apps["Git"][0]['exe_path']
# Clink
# --------------------------------------------------------------------------
clink_install_dir = installed_dev_apps["Clink"][0]['install_dir']
clink_base_dir = clink_install_dir.parent
@@ -116,24 +111,7 @@ if args.with_dev_apps:
url="https://github.com/vladimir-kotikov/clink-completions",
commit_hash=clink_completions_git_hash)
# Odin
# --------------------------------------------------------------------------
# odin_git_hash = "9ae1bfb6"
# odin_install_dir = install_dir / "Odin"
# git_clone(install_dir=odin_install_dir,
# git_exe=git_exe,
# url="https://github.com/odin-lang/odin.git",
# commit_hash=odin_git_hash)
# TODO: We can't do this yet because the odin build requires a registry hack so
# that it knows where to find MSVC.
# Build Odin
# subprocess.run(f"{git_exe} checkout {odin_git_hash}",
# cwd=odin_install_dir)
# Install clink configuration
# --------------------------------------------------------------------------
clink_profile_dir = clink_base_dir / "profile"
clink_settings_path = clink_profile_dir / "clink_settings"
devenver.lprint(f"Installing clink_settings to: {clink_settings_path}")
@@ -178,7 +156,6 @@ fzf.default_bindings = True
""")
# Install wezterm configuration
# --------------------------------------------------------------------------
wezterm_config_dest_path = installed_dev_apps["WezTerm"][0]["install_dir"] / "wezterm.lua"
devenver.lprint(f"Installing WezTerm config to {wezterm_config_dest_path}")
@@ -232,44 +209,17 @@ if "%~1" neq "" (
start "" /MAX "%~dp0{installed_dev_apps["WezTerm"][0]["exe_path"].relative_to(install_dir)}" !working_dir!
""")
# Python
# --------------------------------------------------------------------------
# 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.
python_exe_path = pathlib.Path(installed_dev_apps["Python"][0]['exe_path'])
# 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)
(install_dir / "dev_env_update.bat").write_text(f"""@echo off
setlocal EnableDelayedExpansion
set PYTHONHOME=%~dp0{python_install_dir}
%~dp0{python_rel_exe_path} {install_script_path} --with-dev-apps win
pause
""")
(install_dir / "user_env_update.bat").write_text(f"""@echo off
setlocal EnableDelayedExpansion
set PYTHONHOME=%~dp0{python_install_dir}
%~dp0{python_rel_exe_path} {install_script_path} --with-user-apps win
pause
""")
else:
dev_env_script_path = (install_dir / "dev_env_update.sh")
user_env_script_path = (install_dir / "user_env_update.sh")
dev_env_script_path.write_text(f"{sys.executable} {install_script_path} --with-dev-apps linux\n")
user_env_script_path.write_text(f"{sys.executable} {install_script_path} --with-user-apps linux\n")
subprocess.run(args=["chmod", "+x", dev_env_script_path])
subprocess.run(args=["chmod", "+x", user_env_script_path])
# Use LLVM script to fix up bloated installation
# --------------------------------------------------------------------------
# See: https://github.com/zufuliu/llvm-utils/blob/main/llvm/llvm-link.bat
internal_dir = pathlib.Path(os.path.dirname(os.path.abspath(__file__))) / "Internal"
if is_windows:
@@ -286,13 +236,11 @@ pause
os.remove(llvm_script_dest_path)
# Install fzf scripts
# --------------------------------------------------------------------------
if not is_windows:
shutil.copy(internal_dir / "unix_fzf-completion.bash", install_dir)
shutil.copy(internal_dir / "unix_fzf-key-bindings.bash", install_dir)
# Install left-overs
# --------------------------------------------------------------------------
devenver.print_header("Install configuration files")
# ClangFormat
@@ -322,15 +270,4 @@ pause
nvim_plug_vim_dir.mkdir(parents=True, exist_ok=True)
if not os.path.exists(nvim_plug_vim_path):
devenver.lprint(f"Installing NVIM plugin manager to {nvim_plug_vim_path}")
urllib.request.urlretrieve("https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim",
nvim_plug_vim_path)
# Install user apps
# ------------------------------------------------------------------------------
if args.with_user_apps:
app_list = app_manifest_user.get_manifest(is_windows=is_windows)
installed_user_apps = devenver.run(user_app_list=app_list,
download_dir=download_dir,
install_dir=install_dir,
devenv_script_name="user_env",
is_windows=is_windows)
urllib.request.urlretrieve("https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim", nvim_plug_vim_path)