Update preview installation of Python executables to be non-fatal (#14612)

Previously, if installation of executables into the bin directory failed
we'd with a non-zero code. However, if we make this behavior the default
we don't want it to be fatal. There's a `--bin` opt-in to _require_
successful executable installation and a `--no-bin` opt-out to silence
the warning / opt-out of installation entirely.

Part of https://github.com/astral-sh/uv/issues/14296 — we need this
before we can stabilize the behavior.

In #14614 we do the same for writing entries to the Windows registry.
This commit is contained in:
Zanie Blue
2025-07-15 12:12:36 -05:00
committed by GitHub
parent cd0d5d4748
commit bb1e9a247c
8 changed files with 212 additions and 40 deletions
+3 -4
View File
@@ -129,12 +129,13 @@ fn read_registry_entry(company: &str, tag: &str, tag_key: &Key) -> Option<Window
pub enum ManagedPep514Error {
#[error("Windows has an unknown pointer width for arch: `{_0}`")]
InvalidPointerSize(Arch),
#[error("Failed to write registry entry: {0}")]
WriteError(#[from] windows_result::Error),
}
/// Register a managed Python installation in the Windows registry following PEP 514.
pub fn create_registry_entry(
installation: &ManagedPythonInstallation,
errors: &mut Vec<(PythonInstallationKey, anyhow::Error)>,
) -> Result<(), ManagedPep514Error> {
let pointer_width = match installation.key().arch().family().pointer_width() {
Ok(PointerWidth::U32) => 32,
@@ -146,9 +147,7 @@ pub fn create_registry_entry(
}
};
if let Err(err) = write_registry_entry(installation, pointer_width) {
errors.push((installation.key().clone(), err.into()));
}
write_registry_entry(installation, pointer_width)?;
Ok(())
}