Skip to content

Commit 7d646ec

Browse files
committed
lib: drop "-2" flag for "py.exe" launcher
Now that node-gyp supports both Python 2 and Python 3, We don't need to explicitly try to find only Python 2. Fixes: nodejs#2130 Refs: https://docs.python.org/3/using/windows.html#launcher
1 parent 741ab09 commit 7d646ec

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

lib/find-python.js

+3-8
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ PythonFinder.prototype = {
119119
checks.push({
120120
before: () => {
121121
this.addLog(
122-
'checking if the py launcher can be used to find Python 2')
122+
'checking if the py launcher can be used to find Python')
123123
},
124124
check: this.checkPyLauncher
125125
})
@@ -188,15 +188,10 @@ PythonFinder.prototype = {
188188
// Distributions of Python on Windows by default install with the "py.exe"
189189
// Python launcher which is more likely to exist than the Python executable
190190
// being in the $PATH.
191-
// Because the Python launcher supports all versions of Python, we have to
192-
// explicitly request a Python 2 version. This is done by supplying "-2" as
193-
// the first command line argument. Since "py.exe -2" would be an invalid
194-
// executable for "execFile", we have to use the launcher to figure out
195-
// where the actual "python.exe" executable is located.
196191
checkPyLauncher: function checkPyLauncher (errorCallback) {
197192
this.log.verbose(
198-
`- executing "${this.pyLauncher}" to get Python 2 executable path`)
199-
this.run(this.pyLauncher, ['-2', ...this.argsExecutable], false,
193+
`- executing "${this.pyLauncher}" to get Python executable path`)
194+
this.run(this.pyLauncher, this.argsExecutable, false,
200195
function (err, execPath) {
201196
// Possible outcomes: same as checkCommand
202197
if (err) {

0 commit comments

Comments
 (0)