Skip to content

Commit

Permalink
Some renames
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Sep 3, 2024
1 parent 977b878 commit f8a3d85
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion rye/src/cli/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ pub fn execute(cmd: Args) -> Result<(), Error> {
let uv = UvBuilder::new()
.with_output(CommandOutput::Normal)
.ensure_exists()?;
uv.venv_read_only(&project.venv_path())?.freeze()?;
uv.read_only_venv(&project.venv_path())?.freeze()?;
Ok(())
}
18 changes: 11 additions & 7 deletions rye/src/uv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,9 @@ impl Uv {
cmd
}

/// Ensures a venv is exists or is created at the given path.
/// Returns a UvWithWritableVenv that can be used to run commands in the venv.
/// Ensures a venv exists, creating it at the given path if necessary.
///
/// Returns a [`ReadWriteVenv`] that can be used to run commands in the venv.
pub fn venv(
&self,
venv_dir: &Path,
Expand All @@ -312,14 +313,17 @@ impl Uv {
}
}

/// Ensures a venv is exists or is created at the given path.
/// Returns a UvWithVenv that can be used to run commands in the venv.
pub fn venv_read_only(&self, venv_dir: &Path) -> Result<ReadOnlyVenv, Error> {
/// Returns a [`ReadOnlyVenv`] that can be used to run commands in the venv.
///
/// Returns an error if the venv does not exist.
pub fn read_only_venv(&self, venv_dir: &Path) -> Result<ReadOnlyVenv, Error> {
if venv_dir.is_dir() {
Ok(ReadOnlyVenv::new(self.clone(), venv_dir))
} else {
Err(anyhow!("Virtualenv not found"))
.with_context(|| format!("path: `{}`", venv_dir.display()))
Err(anyhow!(
"Virtualenv not found at path: {}",
venv_dir.display()
))
}
}

Expand Down

0 comments on commit f8a3d85

Please sign in to comment.