diff --git a/CONTRIBUTORS b/CONTRIBUTORS index fc3bc44e6..327e37f27 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -233,6 +233,7 @@ Spiritual Father Emmanuel Ferdman Sunong2008 Marvin Kopf +Kevin Nakamura ******************** The text of the 3 clause BSD license follows: diff --git a/qt/launcher/src/main.rs b/qt/launcher/src/main.rs index 629fbd881..8d5328f73 100644 --- a/qt/launcher/src/main.rs +++ b/qt/launcher/src/main.rs @@ -284,6 +284,32 @@ fn main_menu_loop(state: &State) -> Result<()> { // Remove sync marker before attempting sync let _ = remove_file(&state.sync_complete_marker); + println!("\x1B[1mInstalling Managed Python...\x1B[0m\n"); + + // `uv sync` does not pull in Python automatically, unlike `uv run`. + // This might be system/platform specific and/or a uv bug. + let mut command = Command::new(&state.uv_path); + command + .current_dir(&state.uv_install_root) + .env("UV_CACHE_DIR", &state.uv_cache_dir) + .env("UV_PYTHON_INSTALL_DIR", &state.uv_python_install_dir) + .args(["python", "install"]); + + // Add python version if .python-version file exists + if state.user_python_version_path.exists() { + let python_version = read_file(&state.user_python_version_path)?; + let python_version_str = String::from_utf8(python_version) + .context("Invalid UTF-8 in .python-version")?; + let python_version_trimmed = python_version_str.trim(); + command.args([python_version_trimmed]); + } + + if let Err(e) = command.ensure_success() { + println!("Managed Python Install failed: {e:#}"); + println!(); + continue; + } + // Sync the venv let mut command = Command::new(&state.uv_path); command