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

build: prefer python 3 over 2 for configure #30091

Closed
wants to merge 2 commits into from

Conversation

sam-github
Copy link
Contributor

@sam-github sam-github commented Oct 23, 2019

Change python search order to python3*, then python, then python2*.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added the build Issues and PRs related to build files or the CI. label Oct 23, 2019
@nodejs-github-bot
Copy link
Collaborator

@targos
Copy link
Member

targos commented Oct 23, 2019

could you do it also for windows? the logic is in https://github.com/nodejs/node/blob/master/tools/msvs/find_python.cmd

@targos
Copy link
Member

targos commented Oct 23, 2019

See the comment

:: To remove the preference for Python 2, but still support it, just remove
:: the 5 blocks marked with "Python 2:" and the support warnings

@sam-github
Copy link
Contributor Author

Ok. The 5th block didn't have a clear end, I removed

:: Python 2:
:found-python2
echo Python 2 found in %p%\python.exe
set pyver=2
goto :done
:found-python
echo Python found in %p%\python.exe
echo WARNING: Python 3 is not yet fully supported, to avoid issues Python 2 should be installed.
set pyver=3
goto :done
:done

PTAL @targos

@nodejs-github-bot
Copy link
Collaborator

@sam-github
Copy link
Contributor Author

sam-github commented Oct 23, 2019

If someone can tell me exactly what this needs to be on Windows, I'll add it, but otherwise, I won't have the time for now, and I'll leave it (EDIT: meaning "abandon this PR") for others to pick it up.

cc: @MylesBorins

Copy link
Contributor

@cclauss cclauss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM -- This is music to my ears!!! The mod to configure looks appropriate to me.

I will let others judge the validity of the Windows changes but my choice would have been to simplify by first trying py on Windows.

Given the various issues with macOS Catalina in Node and in Node-gyp and given the fact that Catalina is not yet testable on Travis or GitHub Actions or Jenkins, I am not in a rush that we land this PR.

@joaocgreis
Copy link
Member

@sam-github I pushed a fixup to your branch with the Windows changes, feel free to remove or change as needed. This won't prefer Python 3, but I don't think we need to do that. This uses Python from PATH if it is there, as has always(?) been the Windows behavior.

@cclauss adding a check for py after the PATH and before the registry would be nice (and also in node-gyp!). I might get to it, but since this works I might take a while. Would be happy to review a PR!

sam-github and others added 2 commits October 24, 2019 13:16
Change python search order to python3*, then python, then python2*.
vcbuild now searches for the first python.exe found, and uses it, where
it used to look for Python 2 first.
@sam-github
Copy link
Contributor Author

@joaocgreis Thanks for the commit. I detangled it from my fixup, so the first commit is pure configure and yours is pure vcbuild. I made no changes (I hope!) to your code, but I rewrote the commit message to describe how it behaves on Windows, as its different from using configure.

Please take another look to ensure I got the commit description correct.

@nodejs-github-bot
Copy link
Collaborator

@sam-github
Copy link
Contributor Author

Landed in 11275dc...d1d571e

@sam-github sam-github added the semver-major PRs that contain breaking changes and should be released in the next major version. label Oct 25, 2019
@sam-github
Copy link
Contributor Author

I think calling this major may be incorrect. If we support both py2 and py3, then it shouldn't matter which is found since they both work.

But, I'm not sure how we get that kind of confidence.

But, on the other hand, this only applies to builds of node from source, so perhaps its not so risky?

I'd like some folks from @nodejs/tsc to weigh in. Can we land this on 13.x?

Its easily revertible if it causes problems, and also probably easily fixable.

In the meantime, I labelled it semver-major so it doesn't get pulled into 13.x and below until consideration to the impact happens.

@sam-github sam-github closed this Oct 25, 2019
@sam-github sam-github deleted the prefer-py3 branch October 25, 2019 18:39
sam-github added a commit that referenced this pull request Oct 25, 2019
Change python search order to python3*, then python, then python2*.

PR-URL: #30091
Reviewed-By: Christian Clauss <[email protected]>
Reviewed-By: João Reis <[email protected]>
Reviewed-By: Jiawen Geng <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
sam-github pushed a commit that referenced this pull request Oct 25, 2019
vcbuild now searches for the first python.exe found, and uses it, where
it used to look for Python 2 first.

PR-URL: #30091
Reviewed-By: Christian Clauss <[email protected]>
Reviewed-By: João Reis <[email protected]>
Reviewed-By: Jiawen Geng <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
@cjihrig
Copy link
Contributor

cjihrig commented Oct 25, 2019

If this is considered a semver major, does that mean it wouldn't go out in a release until after python 2 is EOL?

@sam-github
Copy link
Contributor Author

yes

@sam-github
Copy link
Contributor Author

But to be clear, WITHOUT this change, a build host that has only py3 would use py3. In other words, if someone builds 12.x and 13.x and is disturbed to find it used Py2 to run gyp... they should uninstall Py2.

I should also say: Unless any concerns are raised, I'm personally in favour of landing on 13.x after its been on master a week or so, just to make sure no one pulling master is affected. And if after its been on 13.x for a month or 2, it would be considered stable enough for 12.x by @nodejs/lts (I think).

@cjihrig
Copy link
Contributor

cjihrig commented Oct 25, 2019

I would prefer to try it in Node 13 as well due to the Python 2 EOL timing... in a way, that's kind of what the Current branch is for.

@sam-github sam-github added dont-land-on-v12.x and removed semver-major PRs that contain breaking changes and should be released in the next major version. labels Oct 25, 2019
@sam-github
Copy link
Contributor Author

OK, 3 votes for 13.x, none against, so I removed semver-major, and added dont-land-on-12.x so it doesn't hit LTS until its baked a bit on 13.x

@richardlau
Copy link
Member

OK, 3 votes for 13.x, none against, so I removed semver-major, and added dont-land-on-12.x so it doesn't hit LTS until its baked a bit on 13.x

We have a baking-for-lts label for risky things that should wait.

@richardlau richardlau added the baking-for-lts PRs that need to wait before landing in a LTS release. label Oct 25, 2019
targos pushed a commit that referenced this pull request Oct 28, 2019
Change python search order to python3*, then python, then python2*.

PR-URL: #30091
Reviewed-By: Christian Clauss <[email protected]>
Reviewed-By: João Reis <[email protected]>
Reviewed-By: Jiawen Geng <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
targos pushed a commit that referenced this pull request Oct 28, 2019
vcbuild now searches for the first python.exe found, and uses it, where
it used to look for Python 2 first.

PR-URL: #30091
Reviewed-By: Christian Clauss <[email protected]>
Reviewed-By: João Reis <[email protected]>
Reviewed-By: Jiawen Geng <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
@targos targos mentioned this pull request Nov 5, 2019
@targos targos removed the baking-for-lts PRs that need to wait before landing in a LTS release. label Sep 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants