Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: find python checks order changed on windows #2872

Merged
merged 1 commit into from
Jun 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions lib/find-python.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const programFiles = process.env.ProgramW6432 || process.env.ProgramFiles || `${
const programFilesX86 = process.env['ProgramFiles(x86)'] || `${programFiles} (x86)`

const winDefaultLocationsArray = []
for (const majorMinor of ['39', '38', '37', '36']) {
for (const majorMinor of ['311', '310', '39', '38']) {
if (foundLocalAppData) {
winDefaultLocationsArray.push(
`${localAppData}\\Programs\\Python\\Python${majorMinor}\\python.exe`,
Expand Down Expand Up @@ -114,7 +114,20 @@ PythonFinder.prototype = {
},
check: this.checkCommand,
arg: this.env.PYTHON
},
}
]

if (this.win) {
checks.push({
before: () => {
this.addLog(
'checking if the py launcher can be used to find Python 3')
},
check: this.checkPyLauncher
})
}

checks.push(...[
{
before: () => { this.addLog('checking if "python3" can be used') },
check: this.checkCommand,
Expand All @@ -125,7 +138,7 @@ PythonFinder.prototype = {
check: this.checkCommand,
arg: 'python'
}
]
])

if (this.win) {
for (var i = 0; i < this.winDefaultLocations.length; ++i) {
Expand All @@ -139,13 +152,6 @@ PythonFinder.prototype = {
arg: location
})
}
checks.push({
before: () => {
this.addLog(
'checking if the py launcher can be used to find Python 3')
},
check: this.checkPyLauncher
})
}

return checks
Expand Down