Skip to content

Commit

Permalink
Using conda executable path instead of conda python path
Browse files Browse the repository at this point in the history
  • Loading branch information
Kartik Raj committed Dec 19, 2018
1 parent 53f846d commit 9c4aa62
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
5 changes: 4 additions & 1 deletion build/ci/addEnvPath.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@
data = {}
data = {}
with open(jsonPath, 'w') as outfile:
data[key] = sys.executable
if key == 'condaExecPath':
data[key] = sys.argv[3]
else:
data[key] = sys.executable
json.dump(data, outfile, sort_keys=True, indent=4)
4 changes: 4 additions & 0 deletions build/ci/templates/virtual_env_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,17 @@ jobs:
Write-Host $Env:PYTHON_VIRTUAL_ENVS_LOCATION
if( '$(platform)' -eq 'Linux' ){
$condaPythonPath = Join-Path -Path $Env:CONDA -ChildPath $(environmentExecutableFolder) | Join-Path -ChildPath python
$condaExecPath = which conda
}else {
$condaPythonPath = Join-Path -Path $Env:CONDA -ChildPath python
$condaExecPath = which conda
}
& $condaPythonPath ./build/ci/addEnvPath.py $(PYTHON_VIRTUAL_ENVS_LOCATION) condaPath
& $condaPythonPath ./build/ci/addEnvPath.py $(PYTHON_VIRTUAL_ENVS_LOCATION) condaExecPath $condaExecPath
Get-Content $Env:PYTHON_VIRTUAL_ENVS_LOCATION
displayName: 'Save conda environment executable'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ suite('Activation of Environments in Terminal', () => {
path.join(EXTENSION_ROOT_DIR_FOR_TESTS, PYTHON_VIRTUAL_ENVS_LOCATION) : path.join(EXTENSION_ROOT_DIR_FOR_TESTS, 'src', 'tmp', 'envPaths.json');
const waitTimeForActivation = 5000;
type EnvPath = {
condaExecPath: string;
condaPath: string;
venvPath: string;
pipenvPath: string;
Expand Down Expand Up @@ -75,6 +76,8 @@ suite('Activation of Environments in Terminal', () => {
const pyPath = vscode.workspace.getConfiguration('python', vscode.workspace.workspaceFolders[0].uri);
// tslint:disable-next-line:no-console
console.log(`Set pythonPath to ${pyPath.inspect('pythonPath').workspaceFolderValue}`);
// tslint:disable-next-line:no-console
console.log(`Set condaPath to ${pyPath.inspect('condaPath').workspaceFolderValue}`);
if (os.platform() === 'linux') {
// tslint:disable-next-line:no-console
console.log('OS is linux, updating terminal shell Path');
Expand Down Expand Up @@ -134,8 +137,7 @@ suite('Activation of Environments in Terminal', () => {
});
test('Should activate with conda', async () => {
await terminalSettings.update('integrated.shell.windows', 'C:\\Windows\\System32\\cmd.exe', vscode.ConfigurationTarget.Global);

await pythonSettings.update('condaPath', '/opt/python/versions/miniconda3/bin/conda', vscode.ConfigurationTarget.Global);
await pythonSettings.update('condaPath', envPaths.condaExecPath, vscode.ConfigurationTarget.Workspace);
await testActivation(envPaths.condaPath);
});
});

0 comments on commit 9c4aa62

Please sign in to comment.