@@ -9,6 +9,23 @@ const extend = require('util')._extend // eslint-disable-line
9
9
const win = process . platform === 'win32'
10
10
const logWithPrefix = require ( './util' ) . logWithPrefix
11
11
12
+ const systemDrive = process . env . SystemDrive || 'C:'
13
+ const username = process . env . USERNAME || process . env . USER || require ( 'os' ) . userInfo ( ) . username
14
+ const localAppData = process . env . LOCALAPPDATA || `${ systemDrive } \\${ username } \\AppData\\Local`
15
+ const programFiles = process . env . ProgramW6432 || process . env . ProgramFiles || `${ systemDrive } \\Program Files`
16
+ const programFilesX86 = process . env [ 'ProgramFiles(x86)' ] || `${ programFiles } (x86)`
17
+
18
+ const winDefaultLocationsArray = [ ]
19
+ for ( const majorMinor of [ '39' , '38' , '37' , '36' ] ) {
20
+ winDefaultLocationsArray . push (
21
+ `${ localAppData } \\Programs\\Python\\Python${ majorMinor } \\python.exe` ,
22
+ `${ programFiles } \\Python${ majorMinor } \\python.exe` ,
23
+ `${ localAppData } \\Programs\\Python\\Python${ majorMinor } -32\\python.exe` ,
24
+ `${ programFiles } \\Python${ majorMinor } -32\\python.exe` ,
25
+ `${ programFilesX86 } \\Python${ majorMinor } -32\\python.exe`
26
+ )
27
+ }
28
+
12
29
//! after editing file don't forget run "npm test" and
13
30
//! change tests for this file if needed
14
31
@@ -70,17 +87,14 @@ class PythonFinder {
70
87
// for testing
71
88
// 'print("2.1.1")'
72
89
]
73
- this . semverRange = '2.7.x || >=3.5 .0'
90
+ this . semverRange = '>=3.6 .0'
74
91
75
92
// These can be overridden for testing:
76
93
this . execFile = cp . execFile
77
94
this . env = process . env
78
95
this . win = win
79
96
this . pyLauncher = 'py.exe'
80
- this . winDefaultLocations = [
81
- path . join ( process . env . SystemDrive || 'C:' , 'Python37' , 'python.exe' ) ,
82
- path . join ( process . env . SystemDrive || 'C:' , 'Python27' , 'python.exe' )
83
- ]
97
+ this . winDefaultLocations = winDefaultLocationsArray
84
98
}
85
99
86
100
/**
@@ -200,11 +214,6 @@ class PythonFinder {
200
214
checkFunc : this . checkCommand ,
201
215
name : 'python' ,
202
216
arg : 'python'
203
- } ,
204
- {
205
- checkFunc : this . checkCommand ,
206
- name : 'python2' ,
207
- arg : 'python2'
208
217
}
209
218
]
210
219
@@ -227,7 +236,7 @@ class PythonFinder {
227
236
`checking if the ${ colorizeOutput (
228
237
GREEN ,
229
238
'py launcher'
230
- ) } can be used to find Python`
239
+ ) } can be used to find Python 3 `
231
240
)
232
241
} ,
233
242
checkFunc : this . checkPyLauncher ,
@@ -620,7 +629,7 @@ function findPython (configPython, callback) {
620
629
/* findPython(null, (err, found) => {
621
630
console.log('found:', '\x1b[31m', found)
622
631
console.log('\x1b[0m')
623
- })
632
+ })
624
633
*/
625
634
module . exports = findPython
626
635
module . exports . test = {
0 commit comments