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

Revert "build,windows: implement PEP514 python detection" #17293

Closed
wants to merge 1 commit into from
Closed

Revert "build,windows: implement PEP514 python detection" #17293

wants to merge 1 commit into from

Conversation

seishun
Copy link
Contributor

@seishun seishun commented Nov 25, 2017

This reverts commit 614dbbd.

Fixes: #16864

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

build

@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to build files or the CI. install Issues and PRs related to the installers. tools Issues and PRs related to the tools directory. windows Issues and PRs related to the Windows platform. labels Nov 25, 2017
@bnoordhuis
Copy link
Member

Can you add more detail to the commit log?

This reverts commit 614dbbd.

A subroutine does not work as a replacement for the `python` command
since one cannot use a subroutine call in a `for /F` loop. As a
workaround, that commit introduced code that calls :run-python just to
populate an internal variable, then uses it directly. That sacrifices
clarity to support a rare use case and causes surprising behavior when
Python is not found.

Fixes: #16864
@seishun
Copy link
Contributor Author

seishun commented Nov 25, 2017

@bnoordhuis done, PTAL.

@seishun
Copy link
Contributor Author

seishun commented Nov 25, 2017

Copy link
Member

@bnoordhuis bnoordhuis left a comment

Choose a reason for hiding this comment

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

Thanks, LGTM.

@seishun
Copy link
Contributor Author

seishun commented Nov 25, 2017

Requesting fast-track since this is a revert.

@seishun seishun added the fast-track PRs that do not need to wait for 48 hours to land. label Nov 25, 2017
@bnoordhuis
Copy link
Member

Go for it.

@seishun
Copy link
Contributor Author

seishun commented Nov 25, 2017

@evanlucas do you approve just the pull request, or also the fast-tracking request?

The pull request can be landed once 2 or more collaborators approve both the pull request and the fast-tracking request, and the necessary CI testing is done.

@evanlucas
Copy link
Contributor

@seishun both, sorry, I should have clarified. +1 to fast tracking

@seishun
Copy link
Contributor Author

seishun commented Nov 25, 2017

Thanks, going to land in 24 hours if there are no objections.

Copy link
Contributor

@refack refack left a comment

Choose a reason for hiding this comment

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

I think the motivation is low nither for a revert of a commit that landed 5 months ago, nor for fast-track.

Copy link
Contributor

@refack refack left a comment

Choose a reason for hiding this comment

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

I think the motivation is low nither for a revert of a commit that landed 5 months ago, nor for fast-track.

@refack
Copy link
Contributor

refack commented Nov 25, 2017

That sacrifices clarity to support a rare use case and causes surprising behavior when Python is not found.

The "rare use case" has been reported by many first time users (nodejs/CTC#147 (comment)), and has not been reported since.

P.S. this PR does not CC the relevant parties @nodejs/build @nodejs/platform-windows

@seishun
Copy link
Contributor Author

seishun commented Nov 25, 2017

The report you linked looks like hearsay. It might as well have been a misunderstanding. Either way:

In particular, BUILDING.md on Windows does not elaborate on adding Python to the path file..

That should be fixed. Running tests already requires tools from Git for Windows to be in PATH, so requiring Python as well seems reasonable.

@refack
Copy link
Contributor

refack commented Nov 25, 2017

#17298 has a proposed fix that improves the error message without losing PEP514 detection

@benjamingr
Copy link
Member

That should be fixed. Running tests already requires tools from Git for Windows to be in PATH, so requiring Python as well seems reasonable.

For what it's worth, not a single first timer had issues with git in path (since they typically used git bash to build anyway) - but a few had issues with Python.

I'm not expressing an opinion about whether or not Node.js should help users in such cases - it was clear though.

@seishun
Copy link
Contributor Author

seishun commented Nov 26, 2017

since they typically used git bash to build anyway

vcbuild doesn't work in Git Bash though.

@gibfahn
Copy link
Member

gibfahn commented Nov 26, 2017

Requesting fast-track since this is a revert.

I don't think revert automatically means fast-track.

Fixes #16864

Isn't that just a case of an unhelpful error message? Python is required to actually build and test node right?

That sacrifices clarity to support a rare use case and causes surprising behavior when Python is not found.

We landed changes to configure to do similar things to help users confused by the python2 python3 thing, this doesn't seem that different.

node/configure

Lines 3 to 12 in 9de15de

# Locate python2 interpreter and re-execute the script. Note that the
# mix of single and double quotes is intentional, as is the fact that
# the ] goes on a new line.
_=[ 'exec' '/bin/sh' '-c' '''
which python2.7 >/dev/null && exec python2.7 "$0" "$@"
which python2 >/dev/null && exec python2 "$0" "$@"
exec python "$0" "$@"
''' "$0" "$@"
]
del _

I think trying to help users out on Windows is a good thing to do, so I'd rather we fix the issue (e.g. with #17298) than just revert.

The report you linked looks like hearsay. It might as well have been a misunderstanding. Either way:

Are you saying you think there is no scenario in which this change helps people?

@seishun
Copy link
Contributor Author

seishun commented Nov 26, 2017

I don't think revert automatically means fast-track.

No, but it means I can request it.

We landed changes to configure to do similar things to help users confused by the python2 python3 thing, this doesn't seem that different.
Are you saying you think there is no scenario in which this change helps people?

I think we're talking about different things. I'm all for helpful error messages, but going out of our way to locate Python when it's not in PATH seems excessive.

@gibfahn
Copy link
Member

gibfahn commented Nov 26, 2017

Requesting fast-track since this is a revert.
No, but it means I can request it.

Okay, I guess I misunderstood what you meant by since (I hadn't seen the latest update to the Collaborator Guide).

I think we're talking about different things. I'm all for helpful error messages, but going out of our way to locate Python when it's not in PATH seems excessive.

If it can be made to work, and it makes life easier for users, and it's not too difficult to maintain, I don't see the harm in it. In my experience people who install things through GUIs (e.g. me before I started using Linux 😁 ) rarely have experience manually modifying their paths, so why not help them?

@seishun
Copy link
Contributor Author

seishun commented Nov 26, 2017

If it can be made to work, and it makes life easier for users, and it's not too difficult to maintain, I don't see the harm in it.

It does add a maintenance burden, at least in the current form: #17298 (comment)

rarely have experience manually modifying their paths, so why not help them?

The Python installer has an option to add it to PATH. I suppose we could mention that.

@gibfahn
Copy link
Member

gibfahn commented Nov 26, 2017

If it can be made to work, and it makes life easier for users, and it's not too difficult to maintain

It does add a maintenance burden, at least in the current form: #17298 (comment)

I'm hoping @refack can get #17298 to a point where everyone is happy with it.

The Python installer has an option to add it to PATH. I suppose we could mention that.

Probably, although I think #17046 should make life much easier for people who don't already have it installed. This seems more for people who already have it, but didn't tick that box.

@seishun
Copy link
Contributor Author

seishun commented Nov 26, 2017

This seems more for people who already have it, but didn't tick that box.

As in, people who have already been using Python for some time, but somehow never added it to PATH? That seems an unlikely combination.

@benjamingr
Copy link
Member

benjamingr commented Nov 26, 2017

As in, people who have already been using Python for some time, but somehow never added it to PATH? That seems an unlikely combination.

Again - this is something that's been happening in practice. I'm fine with mentioning it in the guide, having an FAQ, or taking a different approach than @refack's fix.

I'm less fine with fast-tracking non-breaking changes in development setup without giving the collaborator who landed them chance to respond. It's not your fault since you followed protocol - we should probably PR the collaborator guide and amend that.

@refack
Copy link
Contributor

refack commented Nov 26, 2017

The root cause is that the GUI installer does not add python to PATH by default (because of the adoption of PEP514):
image
So we should keep changes around this in coordination with #17046 (a silent install will probably not add python to PATH)

@seishun
Copy link
Contributor Author

seishun commented Nov 27, 2017

Git for Windows doesn't add Unix tools required for vcbuild test to PATH by default either:

image

The Boxstarter script in #17046 uses the /GitAndUnixToolsOnPath parameter, perhaps there's something similar for Python?

@bzoz
Copy link
Contributor

bzoz commented Nov 27, 2017

Boxstarter python is added to the PATH

@seishun
Copy link
Contributor Author

seishun commented Dec 28, 2017

@nodejs/collaborators we need to decide whether to merge this PR or #17804. The reasons why I prefer this one are mentioned in #17804. This PR has 3 approvals and 1 change request (not sure if it's still relevant? cc @refack), the other one has 2 approvals, so the opinions seem divided.

@tniessen tniessen removed the fast-track PRs that do not need to wait for 48 hours to land. label Jan 7, 2018
@BridgeAR BridgeAR requested a review from a team January 31, 2018 02:17
@BridgeAR
Copy link
Member

BridgeAR commented Feb 7, 2018

I am closing this as it seems like a decision is needed. This was blocked by @refack and there is a alternative without real complaints. @seishun if you feel differently, please reopen.

@seishun
Copy link
Contributor Author

seishun commented Feb 7, 2018

I would prefer to keep this open until either #17804 or #18621 lands.

@seishun seishun reopened this Feb 7, 2018
@BridgeAR
Copy link
Member

I am going to close this since a mentioned alternative has landed. @seishun if this is not correct, please reopen.

@BridgeAR BridgeAR closed this Feb 16, 2018
@seishun seishun deleted the revert-13900 branch February 16, 2018 19:00
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. install Issues and PRs related to the installers. tools Issues and PRs related to the tools directory. windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

vcbuild explodes is Python is not installed