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

Clean-up python detection #1582

Closed
wants to merge 2 commits into from

Conversation

@joaocgreis
Copy link
Member

commented Oct 26, 2018

This changes Python detection to make it try a sequence of possibilities. Every possibility will be tried discarding errors along the way, only giving up when there's nothing else to try. This should make Python detection more robust.

This stops using which to find the executable, instead relying on the mechanism that was already used for the py launcher: run Python and print sys.executable. This means that BAT files can be used, making node-gyp work when depot_tools is the first thing in the path.

image

@refack I based this on your commit from #1269 . Ended up changing much of it, but I used some of the info text so I include your commit for proper credit. Let me know if I should remove it or if you want to land #1269 separately. I rebased it on master and included es6: true in .eslintrc to make linting work (since ES6 was already there for .jshintrc).

Error output when no Python is installed:
image

Checklist
  • npm install && npm test passes
  • tests are included
  • commit message follows commit guidelines
refack and others added 2 commits Aug 20, 2017
Try everything until Python is found.
@joaocgreis joaocgreis requested review from refack and bnoordhuis Oct 26, 2018
@joaocgreis

This comment has been minimized.

Copy link
Member Author

commented Oct 26, 2018

@joaocgreis

This comment has been minimized.

Copy link
Member Author

commented Nov 2, 2018

The code here will try all the mechanisms for detecting Python. It will produce log messages at verbose level as it goes. However, it will also save the most relevant ones in an array. If detecting Python fails in the end, it will print those messages at error level. This should make issues finding Python much easier to understand, both for the users and for us here.

cc @nodejs/node-gyp

@rvagg
rvagg approved these changes Nov 7, 2018
Copy link
Member

left a comment

hard to review this so it's a bit of a rubber-stamp lgtm

@@ -1,7 +1,7 @@
{
"asi": true,
"laxcomma": true,
"es5": true,
"esversion": 6,

This comment has been minimized.

Copy link
@richardlau

richardlau Nov 7, 2018

Member

This is fine for master but shouldn't be backported to 3.x (do we have the equivalent of core's dont-land labels)?

This comment has been minimized.

Copy link
@joaocgreis

joaocgreis Nov 7, 2018

Author Member

I don't see labels for this. Didn't we already do the final v3 release? I was expecting the next one to be v4 only, though we could do v3 if there is a pressing need of some sort.

This would always be semver-major defensively. Because this is written using new javascript features and removes workarounds for old node versions, this is effectively semver-major.

@joaocgreis

This comment has been minimized.

Copy link
Member Author

commented Nov 7, 2018

Thanks @rvagg! I will land this soon if there is no objection.

joaocgreis added a commit that referenced this pull request Nov 13, 2018
PR-URL: #1269
Refs: #1582
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: João Reis <reis@janeasystems.com>
joaocgreis added a commit that referenced this pull request Nov 13, 2018
Try everything until Python is found.

PR-URL: #1582
Reviewed-By: Rod Vagg <rod@vagg.org>
@joaocgreis

This comment has been minimized.

Copy link
Member Author

commented Nov 13, 2018

Landed in a6990ad

@joaocgreis joaocgreis closed this Nov 13, 2018
rvagg added a commit that referenced this pull request Apr 24, 2019
PR-URL: #1269
Refs: #1582
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: João Reis <reis@janeasystems.com>
rvagg added a commit that referenced this pull request Apr 24, 2019
Try everything until Python is found.

PR-URL: #1582
Reviewed-By: Rod Vagg <rod@vagg.org>
@rvagg rvagg referenced this pull request Apr 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.