node-gyp
node-gyp copied to clipboard
Suggesting some tweaks to `find-python.js` on Windows
Now that a semver major release is being proposed (https://github.com/nodejs/node-gyp/pull/2603), I wanted to mention some thoughts I have about the default Python install paths check for Windows.
See: winDefaultLocations and winDefaultLocationsArray in find-python.js.
- https://github.com/nodejs/node-gyp/blob/v8.4.1/lib/find-python.js#L17-L34
I have a few suggestions in mind:
- Add Python 3.10 to the list of Python versions we generate the paths to search at.
- (See: here, add
'310'to the list)
- (See: here, add
- Try the
py.exelauncher before exhaustively searching all the default install paths used by python.org's installer- (See: here and put the pylauncher check before the default locations loop rather than after.)
- Maybe stop all this default path searching altogether?
- I have felt "eh" about searching (up to) 20 paths trying to find Python, ever since I introduced it. Although I think it's still more helpful than harmful to search for Python in a bunch of places and maybe not find it, since it's still really fast in my experience. Potentially adding another Python version to make it (up to) 25 paths has me feeling slightly more "eh" about it.
Thoughts?
Massive +1 on…
Try the py.exe launcher before exhaustively searching all the default install paths used by python.org's installer
Still need to find time to post a PR for this.
I hope this isn't holding up v9 -- I guess it could go in a v10 or v11 just as easily. (I'll let reviewers decide if/when to merge, and advise at what semver level.) Thought I would have time to post a PR sooner. Sorry about that.