Fix linux chmod+x scripts

This commit is contained in:
Doyle 2023-02-14 12:28:06 +11:00
parent 61d20e5262
commit ba4db25e5c
2 changed files with 22 additions and 11 deletions

View File

@ -782,9 +782,12 @@ def run(user_app_list,
devenv_script_name = f"{devenv_script_name}.bat" if is_windows else f"{devenv_script_name}.sh" devenv_script_name = f"{devenv_script_name}.bat" if is_windows else f"{devenv_script_name}.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: devenv_script_path.write_text(devenv_script_buffer)
file.write(devenv_script_buffer)
if not is_windows:
subprocess.run(args=["chmod", "+x", devenv_script_path])
# Merge the install dictionaries, this dictionary contains # Merge the install dictionaries, this dictionary contains
# (app label) -> [array of installed versions] # (app label) -> [array of installed versions]

View File

@ -86,6 +86,7 @@ if args.with_dev_apps:
is_windows=is_windows) is_windows=is_windows)
install_script_path = pathlib.Path(devenver.script_dir, "install.py")
if is_windows: if is_windows:
# Install MSVC # Install MSVC
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
@ -364,23 +365,30 @@ start "" "%~dp0{installed_dev_apps["SpeedCrunch"][0]["exe_path"].relative_to(ins
subprocess.run(f"{python_exe_path} -m pip install pynvim") subprocess.run(f"{python_exe_path} -m pip install pynvim")
# Add update script # Add update script
python_rel_exe_path = pathlib.Path(python_exe_path).relative_to(install_dir) 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) 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")
(install_dir / "dev_env_update.bat").write_text(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_rel_exe_path} {win_setup_script_path} --with-dev-apps %~dp0{python_rel_exe_path} {install_script_path} --with-dev-apps win
pause pause
""") """)
(install_dir / "user_env_update.bat").write_text(f"""@echo off (install_dir / "user_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_rel_exe_path} {win_setup_script_path} --with-user-apps %~dp0{python_rel_exe_path} {install_script_path} --with-user-apps win
pause 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])
# Install left-overs # Install left-overs
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------