--- a/conda-build/src/lib.rs Thu Feb 26 09:32:12 2026 -0500 +++ b/conda-build/src/lib.rs Wed Apr 22 22:32:00 2026 -0500 @@ -36,26 +36,32 @@ /// Looks up conda Python pub fn python_conda() -> Option<OsString> { option_env!("CONDA_PREFIX").and_then(|conda_prefix| { - /* This does not point to the right place. - option_env!("CONDA_PYTHON_EXE") - .map(OsString::from) - .or_else(|| { */ let py = PathBuf::from(conda_prefix).join("bin/python"); if py.exists() { Some(py.into()) } else { None } - /* })*/ }) } /// Returns a the python configuration and indication whether it's from Conda -pub fn python_config() -> (Result<PythonConfig, PyCError>, bool) { - if let Some(py) = python_conda() { - (PythonConfig::interpreter(py), true) +pub fn python_config() -> ( + Result<PythonConfig, PyCError>, + Option<PathBuf>, + Option<&'static str>, +) { + if let Some(py) = option_env!("VIRTUAL_ENV") { + let interp = PathBuf::from(py).join("bin/python"); + ( + PythonConfig::interpreter(interp), + Some(py.into()), + Some("venv"), + ) + } else if let Some(py) = python_conda() { + (PythonConfig::interpreter(py), None, Some("conda")) } else { - (Ok(PythonConfig::new()), false) + (Ok(PythonConfig::new()), None, None) } }