Skip to content

Commit bbf8ca5

Browse files
authored
Populate name in virtualenvwrapper envs (#199)
virtualenvwrapper environments are named, expose the name appropriately.
1 parent ab810b4 commit bbf8ca5

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

crates/pet-virtualenvwrapper/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,15 @@ impl Locator for VirtualEnvWrapper {
4949
},
5050
};
5151
let mut symlinks = vec![];
52+
let mut name = None;
5253
if let Some(ref prefix) = env.prefix {
5354
symlinks.append(&mut find_executables(prefix));
55+
name = prefix.file_name().and_then(|f| f.to_str());
5456
}
5557

5658
Some(
5759
PythonEnvironmentBuilder::new(Some(PythonEnvironmentKind::VirtualEnvWrapper))
60+
.name(name.map(String::from))
5861
.executable(Some(env.executable.clone()))
5962
.version(version)
6063
.prefix(env.prefix.clone())

crates/pet/tests/ci_test.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ fn check_if_virtualenvwrapper_exists() {
161161
|env| env.kind == Some(PythonEnvironmentKind::VirtualEnvWrapper)
162162
&& env.executable.is_some()
163163
&& env.prefix.is_some()
164+
&& env.name == Some("venv_wrapper_env1".to_string())
164165
&& env
165166
.executable
166167
.clone()

0 commit comments

Comments
 (0)