Linux fixes

This commit is contained in:
doylet 2026-02-14 17:53:35 +11:00
parent 3ac339633a
commit 73f6d4ae58
2 changed files with 117 additions and 144 deletions

View File

@ -511,7 +511,7 @@ internal_app_list = []
devenv_script_buffer = "" devenv_script_buffer = ""
def install_app_list(app_list, download_dir, install_dir, is_windows): def install_app_list(app_list, download_dir, install_dir, is_windows):
title = "Internal Apps" if app_list is internal_app_list else "User Apps" title = "Internal Apps"
print_header(title) print_header(title)
result = {} result = {}
@ -792,11 +792,6 @@ def run(user_app_list,
install_dir=install_dir, install_dir=install_dir,
is_windows=is_windows) is_windows=is_windows)
user_apps = install_app_list(app_list=user_app_list,
download_dir=download_dir,
install_dir=install_dir,
is_windows=is_windows)
# Write the devenv script with environment variables # Write the devenv script with environment variables
if is_windows: if is_windows:
devenv_script_buffer += "set devenver_root_backslash=%~dp0\n" devenv_script_buffer += "set devenver_root_backslash=%~dp0\n"
@ -823,13 +818,5 @@ def run(user_app_list,
if not is_windows: if not is_windows:
subprocess.run(args=["chmod", "+x", devenv_script_path]) subprocess.run(args=["chmod", "+x", devenv_script_path])
# Merge the install dictionaries, this dictionary contains
# (app label) -> [array of installed versions]
result = internal_apps result = internal_apps
for key, value in user_apps.items():
if key not in result:
result.update({key: value})
else:
result[key] += value
return result return result

View File

@ -44,16 +44,6 @@ arg_parser.add_argument('--install-dir',
default="", default="",
type=pathlib.Path) type=pathlib.Path)
arg_parser.add_argument('--with-dev-apps',
help=f'Download and install apps from the developer manifest',
const=True,
action="store_const")
arg_parser.add_argument('--with-user-apps',
help=f'Download and install apps from the user manifest',
const=True,
action="store_const")
arg_parser.add_argument('operating_system', arg_parser.add_argument('operating_system',
choices=['win', 'linux'], choices=['win', 'linux'],
help=f'Download and install apps for the specified operating system') help=f'Download and install apps for the specified operating system')
@ -73,51 +63,47 @@ if install_dir == pathlib.Path(""):
install_dir = devenver.script_dir / 'Linux' install_dir = devenver.script_dir / 'Linux'
# Install development apps # Install development apps
# ------------------------------------------------------------------------------ dev_env_script_name = "dev_env"
if args.with_dev_apps: app_list = app_manifest_dev.get_manifest(is_windows=is_windows)
# Run DEVenver, installing the portable apps installed_dev_apps = devenver.run(user_app_list=app_list,
dev_env_script_name = "dev_env" download_dir=download_dir,
app_list = app_manifest_dev.get_manifest(is_windows=is_windows) install_dir=install_dir,
installed_dev_apps = devenver.run(user_app_list=app_list, devenv_script_name=dev_env_script_name,
download_dir=download_dir, is_windows=is_windows)
install_dir=install_dir, install_script_path = pathlib.Path(devenver.script_dir, "install.py")
devenv_script_name=dev_env_script_name,
is_windows=is_windows)
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']
install_script_path = pathlib.Path(devenver.script_dir, "install.py") # Clink
if is_windows: clink_install_dir = installed_dev_apps["Clink"][0]['install_dir']
# Install apps dependent on Git clink_base_dir = clink_install_dir.parent
devenver.print_header("Install apps that rely on Git")
git_exe = installed_dev_apps["Git"][0]['exe_path']
# Clink # Gizmos
clink_install_dir = installed_dev_apps["Clink"][0]['install_dir'] clink_gizmo_git_hash = "fb2edd9"
clink_base_dir = clink_install_dir.parent clink_gizmo_install_dir = clink_base_dir / "clink-gizmos"
git_clone(install_dir=clink_gizmo_install_dir,
git_exe=git_exe,
url="https://github.com/chrisant996/clink-gizmos",
commit_hash=clink_gizmo_git_hash)
# Gizmos # Completions
clink_gizmo_git_hash = "fb2edd9" clink_completions_git_hash = "86b6f07"
clink_gizmo_install_dir = clink_base_dir / "clink-gizmos" clink_completions_install_dir = clink_base_dir / "clink-completions"
git_clone(install_dir=clink_gizmo_install_dir, git_clone(install_dir=clink_completions_install_dir,
git_exe=git_exe, git_exe=git_exe,
url="https://github.com/chrisant996/clink-gizmos", url="https://github.com/vladimir-kotikov/clink-completions",
commit_hash=clink_gizmo_git_hash) commit_hash=clink_completions_git_hash)
# Completions # Install clink configuration
clink_completions_git_hash = "86b6f07" clink_profile_dir = clink_base_dir / "profile"
clink_completions_install_dir = clink_base_dir / "clink-completions" clink_settings_path = clink_profile_dir / "clink_settings"
git_clone(install_dir=clink_completions_install_dir, devenver.lprint(f"Installing clink_settings to: {clink_settings_path}")
git_exe=git_exe,
url="https://github.com/vladimir-kotikov/clink-completions",
commit_hash=clink_completions_git_hash)
# Install clink configuration clink_settings_path.parent.mkdir(exist_ok=True)
clink_profile_dir = clink_base_dir / "profile" clink_settings_path.write_text(f"""# When this file is named "default_settings" and is in the binaries
clink_settings_path = clink_profile_dir / "clink_settings"
devenver.lprint(f"Installing clink_settings to: {clink_settings_path}")
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
@ -155,121 +141,121 @@ clink.path = {clink_completions_install_dir};{clink_gizmo
fzf.default_bindings = True fzf.default_bindings = True
""") """)
# Install wezterm configuration # Install wezterm configuration
wezterm_config_dest_path = installed_dev_apps["WezTerm"][0]["install_dir"] / "wezterm.lua" wezterm_config_dest_path = installed_dev_apps["WezTerm"][0]["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_config_dest_path.write_text(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 = {{}}
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\\\\..\\\\..\\\\{dev_env_script_name}.bat", wezterm.executable_dir) devenv_bat = string.format("%s\\\\..\\\\..\\\\{dev_env_script_name}.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
-- Use OSC 7 as per the above example -- Use OSC 7 as per the above example
set_environment_variables['prompt'] = set_environment_variables['prompt'] =
'$E]7;file://localhost/$P$E\\\\$E[32m$T$E[0m $E[35m$P$E[36m$_$G$E[0m ' '$E]7;file://localhost/$P$E\\\\$E[32m$T$E[0m $E[35m$P$E[36m$_$G$E[0m '
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}}
end end
return {{ return {{
font_size = 10.0, font_size = 10.0,
color_scheme = "Peppermint", color_scheme = "Peppermint",
default_prog = default_prog, default_prog = default_prog,
set_environment_variables = set_environment_variables, set_environment_variables = set_environment_variables,
}} }}
""") """)
# Wezterm super terminal # Wezterm super terminal
wezterm_terminal_script_path = install_dir / "dev_terminal.bat" wezterm_terminal_script_path = install_dir / "dev_terminal.bat"
devenver.lprint(f"Installing WezTerm terminal script to {wezterm_terminal_script_path}") devenver.lprint(f"Installing WezTerm terminal script to {wezterm_terminal_script_path}")
wezterm_terminal_script_path.write_text(f"""@echo off wezterm_terminal_script_path.write_text(f"""@echo off
setlocal EnableDelayedExpansion setlocal EnableDelayedExpansion
set working_dir= set working_dir=
if "%~1" neq "" ( if "%~1" neq "" (
set working_dir=start --cwd "%~1" set working_dir=start --cwd "%~1"
set working_dir=!working_dir:\=/! set working_dir=!working_dir:\=/!
) )
start "" /MAX "%~dp0{installed_dev_apps["WezTerm"][0]["exe_path"].relative_to(install_dir)}" !working_dir! start "" /MAX "%~dp0{installed_dev_apps["WezTerm"][0]["exe_path"].relative_to(install_dir)}" !working_dir!
""") """)
# Python # Python
python_exe_path = pathlib.Path(installed_dev_apps["Python"][0]['exe_path']) python_exe_path = pathlib.Path(installed_dev_apps["Python"][0]['exe_path'])
# PyNvim # PyNvim
devenver.lprint(f"Installing PyNVIM") devenver.lprint(f"Installing PyNVIM")
subprocess.run(f"{python_exe_path} -m pip install pynvim") subprocess.run(f"{python_exe_path} -m pip install pynvim")
# Use LLVM script to fix up bloated installation # Use LLVM script to fix up bloated installation
# See: https://github.com/zufuliu/llvm-utils/blob/main/llvm/llvm-link.bat # 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" internal_dir = pathlib.Path(os.path.dirname(os.path.abspath(__file__))) / "Internal"
if is_windows: if is_windows:
devenver.print_header("Use LLVM utils script to slim installation size") devenver.print_header("Use LLVM utils script to slim installation size")
llvm_install_dir_set = set() llvm_install_dir_set = set()
for entry in installed_dev_apps["LLVM"]: for entry in installed_dev_apps["LLVM"]:
llvm_install_dir_set.add(entry['install_dir']) llvm_install_dir_set.add(entry['install_dir'])
llvm_script_src_path = internal_dir / "win_llvm-link-ad01970-2022-08-29.bat" llvm_script_src_path = internal_dir / "win_llvm-link-ad01970-2022-08-29.bat"
for llvm_install_dir in llvm_install_dir_set: for llvm_install_dir in llvm_install_dir_set:
llvm_script_dest_path = llvm_install_dir / "llvm-link.bat" llvm_script_dest_path = llvm_install_dir / "llvm-link.bat"
shutil.copy(llvm_script_src_path, llvm_script_dest_path) shutil.copy(llvm_script_src_path, llvm_script_dest_path)
subprocess.run(llvm_script_dest_path, cwd=llvm_install_dir) subprocess.run(llvm_script_dest_path, cwd=llvm_install_dir)
os.remove(llvm_script_dest_path) os.remove(llvm_script_dest_path)
# Install fzf scripts # Install fzf scripts
if not is_windows: if not is_windows:
shutil.copy(internal_dir / "unix_fzf-completion.bash", install_dir) shutil.copy(internal_dir / "unix_fzf-completion.bash", install_dir)
shutil.copy(internal_dir / "unix_fzf-key-bindings.bash", install_dir) shutil.copy(internal_dir / "unix_fzf-key-bindings.bash", install_dir)
# Install dev scripts # Install dev scripts
if is_windows: if is_windows:
shutil.copy(internal_dir / "win_dev.bat", install_dir / "dev.bat") shutil.copy(internal_dir / "win_dev.bat", install_dir / "dev.bat")
else: else:
shutil.copy(internal_dir / "unix_dev.sh", install_dir / "dev.sh") shutil.copy(internal_dir / "unix_dev.sh", install_dir / "dev.sh")
subprocess.run(args=["chmod", "+x", install_dir / "dev.sh") subprocess.run(args=["chmod", "+x", install_dir / "dev.sh"])
# Install left-overs # Install left-overs
devenver.print_header("Install configuration files") devenver.print_header("Install configuration files")
# ClangFormat # ClangFormat
clang_format_src_path = internal_dir / "os_clang_format_style_file" clang_format_src_path = internal_dir / "os_clang_format_style_file"
clang_format_dest_path = install_dir / "_clang-format" clang_format_dest_path = install_dir / "_clang-format"
devenver.lprint(f"Copying clang-format file from {clang_format_src_path} to {clang_format_dest_path}") devenver.lprint(f"Copying clang-format file from {clang_format_src_path} to {clang_format_dest_path}")
shutil.copy(clang_format_src_path, clang_format_dest_path) shutil.copy(clang_format_src_path, clang_format_dest_path)
# Copy init.vim to NVIM directory # Copy init.vim to NVIM directory
nvim_init_dir = "" nvim_init_dir = ""
if is_windows: if is_windows:
nvim_init_dir = pathlib.Path(os.path.expanduser("~")) / "AppData" / "Local" / "nvim" nvim_init_dir = pathlib.Path(os.path.expanduser("~")) / "AppData" / "Local" / "nvim"
else: else:
nvim_init_dir = pathlib.Path(os.path.expanduser("~")) / ".config" / "nvim" nvim_init_dir = pathlib.Path(os.path.expanduser("~")) / ".config" / "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"
devenver.lprint(f"Installing NVIM config to {nvim_config_dest_path}") devenver.lprint(f"Installing NVIM config to {nvim_config_dest_path}")
nvim_init_dir.mkdir(parents=True, exist_ok=True) nvim_init_dir.mkdir(parents=True, exist_ok=True)
shutil.copy(nvim_config_src_path, nvim_config_dest_path) shutil.copy(nvim_config_src_path, nvim_config_dest_path)
# Download vim.plug to NVIM init directory # Download vim.plug to NVIM init directory
nvim_plug_vim_dir = nvim_init_dir / "autoload" nvim_plug_vim_dir = nvim_init_dir / "autoload"
nvim_plug_vim_path = nvim_plug_vim_dir / "plug.vim" nvim_plug_vim_path = nvim_plug_vim_dir / "plug.vim"
nvim_plug_vim_dir.mkdir(parents=True, exist_ok=True) nvim_plug_vim_dir.mkdir(parents=True, exist_ok=True)
if not os.path.exists(nvim_plug_vim_path): if not os.path.exists(nvim_plug_vim_path):
devenver.lprint(f"Installing NVIM plugin manager to {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) urllib.request.urlretrieve("https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim", nvim_plug_vim_path)