mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
set UV_PYTHON_DOWNLOADS=auto when doing uv sync
(#4191)
* set UV_PYTHON_DOWNLOADS=auto when doing `uv sync` * Clear env vars prior to invoking uv, and add --no-config --------- Co-authored-by: Damien Elmes <gpg@ankiweb.net>
This commit is contained in:
parent
1f7f7bc8a3
commit
dfbb7302e8
2 changed files with 5 additions and 19 deletions
|
@ -34,8 +34,9 @@ pub fn setup_pyenv(args: PyenvArgs) {
|
||||||
|
|
||||||
run_command(
|
run_command(
|
||||||
Command::new(args.uv_bin)
|
Command::new(args.uv_bin)
|
||||||
|
.env_clear()
|
||||||
.env("UV_PROJECT_ENVIRONMENT", args.pyenv_folder.clone())
|
.env("UV_PROJECT_ENVIRONMENT", args.pyenv_folder.clone())
|
||||||
.args(["sync", "--locked"])
|
.args(["sync", "--locked", "--no-config"])
|
||||||
.args(args.extra_args),
|
.args(args.extra_args),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -255,29 +255,14 @@ fn handle_version_install_or_update(state: &State, choice: MainMenuChoice) -> Re
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
// `uv sync` sometimes does not pull in Python automatically
|
// Prepare to sync the venv
|
||||||
// This might be system/platform specific and/or a uv bug.
|
|
||||||
let mut command = Command::new(&state.uv_path);
|
let mut command = Command::new(&state.uv_path);
|
||||||
command
|
command
|
||||||
.current_dir(&state.uv_install_root)
|
.current_dir(&state.uv_install_root)
|
||||||
|
.env_clear()
|
||||||
.env("UV_CACHE_DIR", &state.uv_cache_dir)
|
.env("UV_CACHE_DIR", &state.uv_cache_dir)
|
||||||
.env("UV_PYTHON_INSTALL_DIR", &state.uv_python_install_dir)
|
.env("UV_PYTHON_INSTALL_DIR", &state.uv_python_install_dir)
|
||||||
.args(["python", "install", "--managed-python"]);
|
.args(["sync", "--upgrade", "--managed-python", "--no-config"]);
|
||||||
|
|
||||||
// Add python version if .python-version file exists
|
|
||||||
if let Some(version) = &python_version_trimmed {
|
|
||||||
command.args([version]);
|
|
||||||
}
|
|
||||||
|
|
||||||
command.ensure_success().context("Python install failed")?;
|
|
||||||
|
|
||||||
// Sync the venv
|
|
||||||
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(["sync", "--upgrade", "--managed-python"]);
|
|
||||||
|
|
||||||
// Add python version if .python-version file exists
|
// Add python version if .python-version file exists
|
||||||
if let Some(version) = &python_version_trimmed {
|
if let Some(version) = &python_version_trimmed {
|
||||||
|
|
Loading…
Reference in a new issue