diff --git a/devenver.py b/devenver.py index bf3e357..2b006d8 100644 --- a/devenver.py +++ b/devenver.py @@ -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_path = pathlib.Path(install_dir, devenv_script_name) + lprint(f"Writing script to augment the environment with installed applications: {devenv_script_path}") - with open(devenv_script_path, 'w') as file: - file.write(devenv_script_buffer) + devenv_script_path.write_text(devenv_script_buffer) + + if not is_windows: + subprocess.run(args=["chmod", "+x", devenv_script_path]) # Merge the install dictionaries, this dictionary contains # (app label) -> [array of installed versions] diff --git a/install.py b/install.py index edcbf32..ab16d60 100644 --- a/install.py +++ b/install.py @@ -86,6 +86,7 @@ if args.with_dev_apps: is_windows=is_windows) + install_script_path = pathlib.Path(devenver.script_dir, "install.py") if is_windows: # 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") # 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") + 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} {win_setup_script_path} --with-dev-apps +%~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} {win_setup_script_path} --with-user-apps - pause - """) +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]) # Install left-overs # --------------------------------------------------------------------------