forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support venv, virtualEnv in global folders (#23395)
- Loading branch information
1 parent
8993be7
commit 49945b0
Showing
33 changed files
with
128 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,4 @@ pub mod global_virtualenvs; | |
pub mod virtualenvwrapper; | ||
pub mod pipenv; | ||
pub mod virtualenv; | ||
pub mod venv; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
use crate::{ | ||
messaging::{MessageDispatcher, PythonEnvironment, PythonEnvironmentCategory}, | ||
utils::{self, PythonEnv}, | ||
}; | ||
|
||
pub fn is_venv(env: &PythonEnv) -> bool { | ||
return utils::find_pyvenv_config_path(&env.executable).is_some(); | ||
} | ||
|
||
pub fn find_and_report(env: &PythonEnv, dispatcher: &mut impl MessageDispatcher) -> Option<()> { | ||
if is_venv(env) { | ||
let env = PythonEnvironment { | ||
name: match env.path.file_name().to_owned() { | ||
Some(name) => Some(name.to_string_lossy().to_owned().to_string()), | ||
None => None, | ||
}, | ||
python_executable_path: Some(env.executable.clone()), | ||
category: PythonEnvironmentCategory::Venv, | ||
version: env.version.clone(), | ||
env_path: Some(env.path.clone()), | ||
sys_prefix_path: Some(env.path.clone()), | ||
env_manager: None, | ||
python_run_command: Some(vec![env.executable.to_str().unwrap().to_string()]), | ||
project_path: None, | ||
}; | ||
|
||
dispatcher.report_environment(env); | ||
|
||
return Some(()); | ||
} | ||
None | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.