in glean/src/cli.ts [171:199]
async function createPythonVenv(venvPath: string): Promise<boolean> {
log(LOG_TAG, `Creating a virtual environment at ${venvPath}`);
const pipFilename = process.env.GLEAN_PIP ?? getPipBinName();
const venvPip =
path.join(getPythonVenvBinariesPath(VIRTUAL_ENVIRONMENT_DIR), pipFilename);
const pipCmd = `${venvPip} install wheel`;
const pythonBinary = process.env.GLEAN_PYTHON ?? getSystemPythonBinName();
const venvCmd = `${pythonBinary} -m venv ${VIRTUAL_ENVIRONMENT_DIR}`;
for (const cmd of [venvCmd, pipCmd]) {
const spinner = getStartedSpinner();
const {err, stdout, stderr} = await new Promise<{err: exec.ExecException | null, stdout: string, stderr: string}>(resolve => {
exec.exec(cmd, (err, stdout, stderr) => resolve({err, stdout, stderr}));
});
stopSpinner(spinner);
log(LOG_TAG, `${stdout}`);
if (err) {
log(LOG_TAG, `${stderr}`);
return false;
}
}
return true;
}