Fix some ephemeral-to-cached comments (#4837)

This commit is contained in:
Charlie Marsh 2024-07-05 17:11:19 -04:00 committed by GitHub
parent f450b45780
commit 77b1bb77b5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 8 deletions

View file

@ -15,13 +15,13 @@ use crate::commands::SharedState;
use crate::printer::Printer; use crate::printer::Printer;
use crate::settings::ResolverInstallerSettings; use crate::settings::ResolverInstallerSettings;
/// An ephemeral [`PythonEnvironment`] stored in the cache. /// A [`PythonEnvironment`] stored in the cache.
#[derive(Debug)] #[derive(Debug)]
pub(crate) struct CachedEnvironment(PythonEnvironment); pub(crate) struct CachedEnvironment(PythonEnvironment);
impl From<CachedEnvironment> for PythonEnvironment { impl From<CachedEnvironment> for PythonEnvironment {
fn from(ephemeral: CachedEnvironment) -> Self { fn from(environment: CachedEnvironment) -> Self {
ephemeral.0 environment.0
} }
} }
@ -100,7 +100,7 @@ impl CachedEnvironment {
let ok = cache_entry.path().join(".ok"); let ok = cache_entry.path().join(".ok");
if ok.is_file() { if ok.is_file() {
debug!( debug!(
"Found existing ephemeral environment at: `{}`", "Found existing cached environment at: `{}`",
cache_entry.path().display() cache_entry.path().display()
); );
return Ok(Self(PythonEnvironment::from_root( return Ok(Self(PythonEnvironment::from_root(
@ -110,7 +110,7 @@ impl CachedEnvironment {
} }
debug!( debug!(
"Creating ephemeral environment at: `{}`", "Creating cached environment at: `{}`",
cache_entry.path().display() cache_entry.path().display()
); );
@ -122,7 +122,6 @@ impl CachedEnvironment {
false, false,
)?; )?;
// Install the ephemeral requirements.
// TODO(charlie): Rather than passing all the arguments to `sync_environment`, return a // TODO(charlie): Rather than passing all the arguments to `sync_environment`, return a
// struct that lets us "continue" from `resolve_environment`. // struct that lets us "continue" from `resolve_environment`.
let venv = sync_environment( let venv = sync_environment(
@ -145,7 +144,7 @@ impl CachedEnvironment {
Ok(Self(venv)) Ok(Self(venv))
} }
/// Convert the [`EphemeralEnvironment`] into an [`Interpreter`]. /// Convert the [`CachedEnvironment`] into an [`Interpreter`].
pub(crate) fn into_interpreter(self) -> Interpreter { pub(crate) fn into_interpreter(self) -> Interpreter {
self.0.into_interpreter() self.0.into_interpreter()
} }

View file

@ -134,7 +134,7 @@ pub(crate) async fn run(
/// Get or create a [`PythonEnvironment`] in which to run the specified tools. /// Get or create a [`PythonEnvironment`] in which to run the specified tools.
/// ///
/// If the target tool is already installed in a compatible environment, returns that /// If the target tool is already installed in a compatible environment, returns that
/// [`PythonEnvironment`]. Otherwise, creates an ephemeral environment. /// [`PythonEnvironment`]. Otherwise, gets or creates a [`CachedEnvironment`].
async fn get_or_create_environment( async fn get_or_create_environment(
from: &str, from: &str,
with: &[String], with: &[String],