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

Fixed handling of missing python on Windows. #1325

Closed
wants to merge 11 commits into from

Conversation

mvidmar
Copy link

@mvidmar mvidmar commented Nov 4, 2017

Checklist
  • npm install && npm test passes
  • tests are included
  • documentation is changed or added
  • commit message follows commit guidelines
Description of change

configure: fixing to better handle python badVersion on windows platform

  • invalid error message when python is found but is invalid version
    error returned: file not found but with valid file path which is
    confusing. error expected: invalid python version.
  • in case of invalid version on guessed path (python27) it goes into
    an endless loop (unlikely but an ugly error)

refs #1269

isaacs and others added 11 commits June 6, 2017 06:56
Tar version 3 performs better and is more well tested than its
predecessor.  npm will be using this in the near future, so there is no
benefit in shipping a node-gyp that uses the slower and less reliable
fstream-based tar.

This drops support for node 0.x, and thus should be considered a
breaking semver-major change.

PR-URL: nodejs#1212
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
* dropping support for node < 4
* signal the CI not to test node < 4
If you're providing a path to a header tarball to install, you probably
want it to always be re-installed.

PR-URL: nodejs#1220
Fixes: nodejs#1216
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Refael Ackermann <refack@gmail.com>
* test: build simple addon in path with non-ascii characters
* test: add test-charmap.py

PR-URL: nodejs#1203
Reviewed-By: Refael Ackermann <refack@gmail.com>
Enable linking to the platform specific installation instructions

PR-URL: nodejs#1225
Reviewed-By: Refael Ackermann <refack@gmail.com>
Lifted verbatim from
https://github.com/nodejs/node/blob/master/CONTRIBUTING.md
then `s/Node.js/node-gyp/`.

PR-URL: nodejs#1229
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Give users reporting bugs a clearer idea of the info that will be
helpful when reporting issues.

PR-URL: nodejs#1228
Refs: https://github.com/nodejs/node/tree/master/.github
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
PR-URL: nodejs#1292
Refs: nodejs#1195 (comment)
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Initial work to add z/OS support to node-gyp.


PR-URL: nodejs#1276
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
GYP automatically turns variables ending in _dir, _file or _path into
absolute paths but didn't check for empty strings.

It interacted badly with variables inherited through the environment
from npm, the `scripts-prepend-node-path=false` setting in particular
because it is turned into `npm_config_script_prepend_node_path=`.

Fixes: nodejs#1217
PR-URL: nodejs#1267
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
… error message when python is found but invalid version (error returned: file not found with valid file path, expected: invalid python version). 2. in case of invalid version on guessed path (python27) it goes into an endless loop (unlikely but an ugly error)
@mvidmar mvidmar mentioned this pull request Nov 5, 2017
3 tasks
@refack refack self-assigned this Nov 5, 2017
@refack
Copy link
Contributor

refack commented Nov 5, 2017

@refack
Copy link
Contributor

refack commented Nov 5, 2017

Hello @mvidmar and welcome! Thank you for the fix 🥇

Could you describe the situation that causes the endless recursion (I want to try to design a test around that)?

Also If you could adjust the commit message to our style guide (which is roughly based on node-core's)

@mvidmar
Copy link
Author

mvidmar commented Nov 5, 2017

Tried to fix the commit message according to the style guide, let me know if I missed something.

The loop happens on Windows when c:\Python27\python.exe is not a valid version (like I mentioned - unlikely but possible. Happened to me during trying to get an understanding of this code). The loop happens from checkPythonVersion, call to checkPythonLauncher, then guessPython, which finds the executable and then reruns checkPythonVersion. That's why I added an increase of checkPythonLauncherDepth within guessPython so it skips the fallback to checkPythonLauncher. If you remove that line and put an invalid version in c:\Python27\python.exe it loops.

I also merged our fixes in case you want to pull that instead of this fix. Since I noticed you modified some other stuff as well. Here is the merged fix with PR 1269 mvidmar@9c7ad90

@rvagg
Copy link
Member

rvagg commented Jun 21, 2019

hi @mvidmar do you still want to pursue this? if so, rebase against master and let's sort out a few style nits and get some windows people involved again

@joaocgreis
Copy link
Member

The current code to find Python already includes both these features, I think this can be closed. If I missed something, please rebase on current master. Thanks!

@joaocgreis joaocgreis closed this Jul 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet