Skip to content

Commit

Permalink
find-python.js: Stop using the "-2" flag
Browse files Browse the repository at this point in the history
Now that node-gyp supports both Python 2 and Python 3,
We don't need to explicitly try to find only Python 2.
  • Loading branch information
DeeDeeG authored May 15, 2020
1 parent 741ab09 commit bb768d0
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions lib/find-python.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ PythonFinder.prototype = {
checks.push({
before: () => {
this.addLog(
'checking if the py launcher can be used to find Python 2')
'checking if the py launcher can be used to find Python')
},
check: this.checkPyLauncher
})
Expand Down Expand Up @@ -188,15 +188,10 @@ PythonFinder.prototype = {
// Distributions of Python on Windows by default install with the "py.exe"
// Python launcher which is more likely to exist than the Python executable
// being in the $PATH.
// Because the Python launcher supports all versions of Python, we have to
// explicitly request a Python 2 version. This is done by supplying "-2" as
// the first command line argument. Since "py.exe -2" would be an invalid
// executable for "execFile", we have to use the launcher to figure out
// where the actual "python.exe" executable is located.
checkPyLauncher: function checkPyLauncher (errorCallback) {
this.log.verbose(
`- executing "${this.pyLauncher}" to get Python 2 executable path`)
this.run(this.pyLauncher, ['-2', ...this.argsExecutable], false,
`- executing "${this.pyLauncher}" to get Python executable path`)
this.run(this.pyLauncher, [...this.argsExecutable], false,
function (err, execPath) {
// Possible outcomes: same as checkCommand
if (err) {
Expand Down

4 comments on commit bb768d0

@cclauss

This comment was marked as outdated.

@cclauss

This comment was marked as outdated.

@DeeDeeG

This comment was marked as outdated.

@DeeDeeG

This comment was marked as outdated.

Please sign in to comment.