Initialize all --prefix subdirectories (#4895)

## Summary

We need to initialize the same directories that we create in `bare.rs`,
since the installer expects them to exist.

Closes #4892.
This commit is contained in:
Charlie Marsh 2024-07-08 09:15:25 -05:00 committed by GitHub
parent 2d651fe264
commit b9d661012d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 26 additions and 36 deletions

View file

@ -124,21 +124,21 @@ impl Interpreter {
}
/// Return a new [`Interpreter`] to install into the given `--target` directory.
#[must_use]
pub fn with_target(self, target: Target) -> Self {
Self {
pub fn with_target(self, target: Target) -> io::Result<Self> {
target.init()?;
Ok(Self {
target: Some(target),
..self
}
})
}
/// Return a new [`Interpreter`] to install into the given `--prefix` directory.
#[must_use]
pub fn with_prefix(self, prefix: Prefix) -> Self {
Self {
pub fn with_prefix(self, prefix: Prefix) -> io::Result<Self> {
prefix.init(self.virtualenv())?;
Ok(Self {
prefix: Some(prefix),
..self
}
})
}
/// Return the [`Interpreter`] for the base executable, if it's available.