mirror of
https://github.com/electron/node-gyp.git
synced 2025-08-15 12:58:19 +02:00
lib: find python checks order changed on windows (#2872)
These changes favor py launcher over other checks excluding command line or npm configuration and environment variable checks. Also, updated supported python versions list. Fixes: https://github.com/nodejs/node-gyp/issues/2871
This commit is contained in:
parent
192eec2aca
commit
b030555cdb
1 changed files with 16 additions and 10 deletions
|
@ -14,7 +14,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`,
|
||||
|
@ -113,7 +113,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,
|
||||
|
@ -124,7 +137,7 @@ PythonFinder.prototype = {
|
|||
check: this.checkCommand,
|
||||
arg: 'python'
|
||||
}
|
||||
]
|
||||
])
|
||||
|
||||
if (this.win) {
|
||||
for (let i = 0; i < this.winDefaultLocations.length; ++i) {
|
||||
|
@ -138,13 +151,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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue