diff --git a/src/modules/python.rs b/src/modules/python.rs index 366fd68b..2668589b 100644 --- a/src/modules/python.rs +++ b/src/modules/python.rs @@ -73,7 +73,13 @@ fn get_python_version() -> Option { } fn format_python_version(python_stdout: &str) -> String { - format!("v{}", python_stdout.trim_start_matches("Python ").trim()) + format!( + "v{}", + python_stdout + .trim_start_matches("Python ") + .trim_end_matches(":: Anaconda, Inc.") + .trim() + ) } fn get_python_virtual_env() -> Option { @@ -93,4 +99,10 @@ mod tests { let input = "Python 3.7.2"; assert_eq!(format_python_version(input), "v3.7.2"); } + + #[test] + fn test_format_python_version_anaconda() { + let input = "Python 3.6.10 :: Anaconda, Inc."; + assert_eq!(format_python_version(input), "v3.6.10"); + } }