From b1b92a78553232b8942ce9e1fe1929731f0e0f73 Mon Sep 17 00:00:00 2001 From: konstin Date: Mon, 11 Dec 2023 22:33:17 +0100 Subject: [PATCH 1/2] Allow identical `VIRTUAL_ENV` and `CONDA_PREFIX` env vars Fixes #1878 --- src/main.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main.rs b/src/main.rs index d87452473..1ca4b960b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -191,6 +191,9 @@ fn detect_venv(target: &Target) -> Result { match (env::var_os("VIRTUAL_ENV"), env::var_os("CONDA_PREFIX")) { (Some(dir), None) => return Ok(PathBuf::from(dir)), (None, Some(dir)) => return Ok(PathBuf::from(dir)), + (Some(venv), Some(conda)) if venv == conda => { + return Ok(PathBuf::from(venv)) + } (Some(_), Some(_)) => { bail!("Both VIRTUAL_ENV and CONDA_PREFIX are set. Please unset one of them") } From 16019fee99d1fc79a8e432ef3fae507c8d2047d8 Mon Sep 17 00:00:00 2001 From: messense Date: Tue, 12 Dec 2023 02:02:53 +0000 Subject: [PATCH 2/2] cargo fmt --- src/main.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index 1ca4b960b..b4147d61d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -191,9 +191,7 @@ fn detect_venv(target: &Target) -> Result { match (env::var_os("VIRTUAL_ENV"), env::var_os("CONDA_PREFIX")) { (Some(dir), None) => return Ok(PathBuf::from(dir)), (None, Some(dir)) => return Ok(PathBuf::from(dir)), - (Some(venv), Some(conda)) if venv == conda => { - return Ok(PathBuf::from(venv)) - } + (Some(venv), Some(conda)) if venv == conda => return Ok(PathBuf::from(venv)), (Some(_), Some(_)) => { bail!("Both VIRTUAL_ENV and CONDA_PREFIX are set. Please unset one of them") }