mirror of
https://github.com/ankitects/anki.git
synced 2026-01-13 22:13:58 -05:00
Launcher: Run uv python install before running uv sync
This commit is contained in:
parent
d1793550b0
commit
547d022f09
2 changed files with 27 additions and 0 deletions
|
|
@ -233,6 +233,7 @@ Spiritual Father <https://github.com/spiritualfather>
|
||||||
Emmanuel Ferdman <https://github.com/emmanuel-ferdman>
|
Emmanuel Ferdman <https://github.com/emmanuel-ferdman>
|
||||||
Sunong2008 <https://github.com/Sunrongguo2008>
|
Sunong2008 <https://github.com/Sunrongguo2008>
|
||||||
Marvin Kopf <marvinkopf@outlook.com>
|
Marvin Kopf <marvinkopf@outlook.com>
|
||||||
|
Kevin Nakamura <grinkers@grinkers.net>
|
||||||
********************
|
********************
|
||||||
|
|
||||||
The text of the 3 clause BSD license follows:
|
The text of the 3 clause BSD license follows:
|
||||||
|
|
|
||||||
|
|
@ -284,6 +284,32 @@ fn main_menu_loop(state: &State) -> Result<()> {
|
||||||
// Remove sync marker before attempting sync
|
// Remove sync marker before attempting sync
|
||||||
let _ = remove_file(&state.sync_complete_marker);
|
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
|
// Sync the venv
|
||||||
let mut command = Command::new(&state.uv_path);
|
let mut command = Command::new(&state.uv_path);
|
||||||
command
|
command
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue