Skip to content

Commit

Permalink
only return idf-python if path exists
Browse files Browse the repository at this point in the history
  • Loading branch information
brianignacio5 committed Jan 15, 2025
1 parent 3d1537e commit 61cdb7c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
3 changes: 2 additions & 1 deletion src/pythonManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,8 @@ export async function getSystemPython(workspaceFolder: Uri) {
pythonVersionToUse,
"python.exe"
);
return idfPyDestPath;
const idfPyDestExists = await pathExists(idfPyDestPath);
return idfPyDestExists ? idfPyDestPath : "";
}
}

Expand Down
27 changes: 13 additions & 14 deletions src/setup/setupInit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,20 +227,6 @@ export async function isCurrentInstallValid(workspaceFolder: Uri) {
process.env.IDF_TOOLS_PATH ||
path.join(containerPath, ".espressif");

// FIX use system Python path as setting instead venv
// REMOVE this line after next release
const sysPythonBinPath = await getPythonPath(workspaceFolder);

let pythonBinPath: string = "";
if (sysPythonBinPath) {
pythonBinPath = await getVirtualEnvPythonPath(workspaceFolder);
} else {
pythonBinPath = idfConf.readParameter(
"idf.pythonBinPath",
workspaceFolder
) as string;
}

let espIdfPath = idfConf.readParameter("idf.espIdfPath", workspaceFolder);
let idfPathVersion = await utils.getEspIdfFromCMake(espIdfPath);
if (idfPathVersion === "x.x" && process.platform === "win32") {
Expand Down Expand Up @@ -291,6 +277,19 @@ export async function isCurrentInstallValid(workspaceFolder: Uri) {
if (failedToolsResult.length !== 0) {
return false;
}
// FIX use system Python path as setting instead venv
// REMOVE this line after next release
const sysPythonBinPath = await getPythonPath(workspaceFolder);

let pythonBinPath: string = "";
if (sysPythonBinPath) {
pythonBinPath = await getVirtualEnvPythonPath(workspaceFolder);
} else {
pythonBinPath = idfConf.readParameter(
"idf.pythonBinPath",
workspaceFolder
) as string;
}
const isPyEnvValid = await checkPyVenv(pythonBinPath, espIdfPath);
return isPyEnvValid;
}
Expand Down

0 comments on commit 61cdb7c

Please sign in to comment.