use crate::error::*;
use crate::operations;
use crate::ui::*;
use crate::Context;
pub fn ensure_venv(context: &Context) -> Result<(), Error> {
let Context { paths, .. } = context;
if paths.venv.exists() {
print_info_2(&format!(
"Using existing virtualenv: {}",
paths.venv.display()
));
} else {
create_venv(context)?;
}
Ok(())
}
pub fn create_venv(context: &Context) -> Result<(), Error> {
let Context {
paths,
python_info,
settings,
..
} = context;
operations::venv::create(&paths.venv, python_info, settings)
}
pub fn clean_venv(context: Context) -> Result<(), Error> {
let Context { paths, .. } = context;
operations::venv::clean(paths.venv)
}
pub fn expect_venv(context: &Context) -> Result<(), Error> {
let Context { paths, .. } = context;
operations::venv::expect(&paths.venv)
}