(pythonPath: Uri | undefined)
| 110 | } |
| 111 | |
| 112 | async function getPythonCli(pythonPath: Uri | undefined) { |
| 113 | const isConda = await isCondaEnvironment(pythonPath); |
| 114 | if (isConda) { |
| 115 | try { |
| 116 | const available = isCondaAvailable(); |
| 117 | if (!available) { |
| 118 | throw new Error('No conda but using conda interpreter'); |
| 119 | } |
| 120 | const condaInfo = await getCondaEnvironment(pythonPath); |
| 121 | const runArgs = ['run']; |
| 122 | if (!condaInfo) { |
| 123 | throw new Error('No conda info'); |
| 124 | } else if (condaInfo.name === '') { |
| 125 | runArgs.push('-p', condaInfo.path.fsPath); |
| 126 | } else { |
| 127 | runArgs.push('-n', condaInfo.name); |
| 128 | } |
| 129 | |
| 130 | const condaFile = await getCondaFile(); |
| 131 | return [fileToCommandArgument(condaFile), ...runArgs, 'python']; |
| 132 | } catch { |
| 133 | // Noop. |
| 134 | } |
| 135 | logger.error('Using Conda Interpreter, but no conda'); |
| 136 | } |
| 137 | return pythonPath ? [fileToCommandArgument(pythonPath.fsPath)] : []; |
| 138 | } |
no test coverage detected