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

tools: Use print() function on both Python 2 and 3 #24486

Merged
merged 1 commit into from
Nov 26, 2018

Conversation

cclauss
Copy link
Contributor

@cclauss cclauss commented Nov 19, 2018

A subset of #23669 to simplify the review process. @refack @addaleax

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 build Issues and PRs related to build files or the CI. i18n-api Issues and PRs related to the i18n implementation. test Issues and PRs related to the tests. tools Issues and PRs related to the tools directory. labels Nov 19, 2018
@addaleax
Copy link
Member

Is there any chance of the GYP patches being upstreamed? If not, it would be great to finally do the thing where we pull changes from our own fork of it…

@cclauss
Copy link
Contributor Author

cclauss commented Nov 19, 2018

@addaleax Working on that in parallel. It would be a lot easier is we pip installed our Python dependencies instead of vendoring them in.

@Trott
Copy link
Member

Trott commented Nov 19, 2018

@nodejs/python

@refack
Copy link
Contributor

refack commented Nov 19, 2018

@cclauss thank you for making it easier to review.
IMHO you should exclude tools/gyp. For that I'm going to port your patch from nodejs/node-gyp#1335 since it has already received test coverage.
(I plan to do it VIA refack/GYP, once I get the GYP CI test suite revived)

@refack refack added the python PRs and issues that require attention from people who are familiar with Python. label Nov 19, 2018
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.

Should exclude tools/GYP and tools/inspector_protocol

@refack
Copy link
Contributor

refack commented Nov 19, 2018

P.S. I'm self-assigned this so I'll get notifications from Github, and so that I will not lose track of it and help steward it to completion.

@refack refack self-assigned this Nov 19, 2018
@@ -1,3 +1,4 @@
from __future__ import print_function
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: This would be better if it followed the copyright notice.

Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't our code. It should be patched upstream at https://chromium.googlesource.com/deps/inspector_protocol/

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, okay. Sure, this has to be updated in upstream then.

Copy link
Contributor

Choose a reason for hiding this comment

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

@cclauss Sorry I didn't notice this before.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will remove inspector_protocol from this PR.

However this opens up a can of worms that I do not have a solution for. Chromium in general and v8 specifically are not on GitHub. Their GitHub mirror does not accept pull requests. The v8 repo is just 1.4% Python but that is all legacy Python and at least 76 files need to be modified just to fix the print statement which is merely the start of a Python 3 port. v8 is a venerable codebase and I often hear that it was a godsend to the JavaScript community but its Python code needs to be modernized, removed, or replaced with JavaScript, Go, etc. 407 days until Python 2 end of life. @hugovk your expert advise here please.

Copy link
Contributor

Choose a reason for hiding this comment

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

So they do accept PRs (which they call CLs) you just need to do it their way:
https://v8.dev/docs/contribute
As for inspector_protocol it's a sub project so submitting patches should be simpler.
/cc @aslushnikov @ak239

Copy link
Contributor

Choose a reason for hiding this comment

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

As for inspector_protocol it's a sub project so submitting patches should be simpler.

It's quite similar for both v8 and inspector-protocol.

For the inspector-protocol, check out these links:

@refack
Copy link
Contributor

refack commented Nov 20, 2018

@srl295 where do the python scripts in tools/icu/ come from?

@refack
Copy link
Contributor

refack commented Nov 20, 2018

@refack
Copy link
Contributor

refack commented Nov 20, 2018

I will remove inspector_protocol from this PR.

The v8 repo is just 1.4% Python but that is all legacy Python and at least 76 files need to be modified just to fix the print statement which is merely the start of a Python 3 port.

@cclauss from the Node.js perspective, IMHO our first goal is to get the main build@test (a.k.a CI) workflow compatible with python3.
Since inspector_protocol is a code-gen tool we can workaround it by checking-in the generated code (#22680). We need to identify which other python scripts from V8 we use (via https://github.com/nodejs/node/blob/master/deps/v8/gypfiles/v8.gyp)

@cclauss
Copy link
Contributor Author

cclauss commented Nov 20, 2018

Sounds like a good plan.

@refack refack added the fast-track PRs that do not need to wait for 48 hours to land. label Nov 20, 2018
@refack
Copy link
Contributor

refack commented Nov 20, 2018

CI: https://ci.nodejs.org/job/node-test-pull-request/18805/

Reviewers please consider this for fast-tracking by 👍 .

@thefourtheye
Copy link
Contributor

@srl295 where do the python scripts in tools/icu/ come from?

I looked at the git logs, it looks like its our own. Just to be sure, can we wait till @srl295 confirms?

@refack refack removed the fast-track PRs that do not need to wait for 48 hours to land. label Nov 20, 2018
@refack
Copy link
Contributor

refack commented Nov 20, 2018

can we wait till @srl295 confirms?

ack.

@cclauss
Copy link
Contributor Author

cclauss commented Nov 25, 2018

Should I break this into seven separate PRs to make it easier to review?

targos pushed a commit that referenced this pull request Nov 27, 2018
PR-URL: #24486
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
rvagg pushed a commit that referenced this pull request Nov 28, 2018
PR-URL: #24486
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
danbev pushed a commit that referenced this pull request Dec 3, 2018
While running the test suite the progress bar shows former line
endings if the new line is shorter than the former line. The length
was calculated without the line ending. It is now an empty string
to prevent the off by one error instead of using extra whitespace.

PR-URL: #24748
Refs: #24486
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
danbev pushed a commit that referenced this pull request Dec 3, 2018
PR-URL: #24748
Refs: #24486
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
BridgeAR added a commit that referenced this pull request Dec 5, 2018
While running the test suite the progress bar shows former line
endings if the new line is shorter than the former line. The length
was calculated without the line ending. It is now an empty string
to prevent the off by one error instead of using extra whitespace.

PR-URL: #24748
Refs: #24486
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
BridgeAR added a commit that referenced this pull request Dec 5, 2018
PR-URL: #24748
Refs: #24486
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
@BridgeAR BridgeAR mentioned this pull request Dec 5, 2018
4 tasks
@srl295
Copy link
Member

srl295 commented Dec 18, 2018

@refack sorry :( yes, they are 'our own'. I wrote them origianlly to be part of ICU, but the python scripts should be considered part of node.

Incidentally, ICU itself will require python for build-from-repo (not from tarball). At this point it will require python 2.7 or 3.

Copy link
Member

@srl295 srl295 left a comment

Choose a reason for hiding this comment

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

I really thought I +1'ed a similar change here. but anyway, post merge LGTM. There's no need to upstream ICU's .py files at this point.

@thefourtheye
Copy link
Contributor

@srl295 Thanks for confirming 🙂

@srl295
Copy link
Member

srl295 commented Dec 19, 2018

But on this point ICU as of 2 days ago does actually have its own slicer— please see #25136 and comment on the upstream design. This would replace node's special code (and it runs on python 2.7 and 3).

refack pushed a commit to refack/node that referenced this pull request Jan 14, 2019
PR-URL: nodejs#24486
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
refack pushed a commit to refack/node that referenced this pull request Jan 14, 2019
While running the test suite the progress bar shows former line
endings if the new line is shorter than the former line. The length
was calculated without the line ending. It is now an empty string
to prevent the off by one error instead of using extra whitespace.

PR-URL: nodejs#24748
Refs: nodejs#24486
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
refack pushed a commit to refack/node that referenced this pull request Jan 14, 2019
PR-URL: nodejs#24748
Refs: nodejs#24486
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
BethGriggs pushed a commit that referenced this pull request Feb 11, 2019
PR-URL: #24486
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
BethGriggs pushed a commit that referenced this pull request Feb 12, 2019
PR-URL: #24748
Refs: #24486
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
BethGriggs pushed a commit that referenced this pull request Feb 12, 2019
While running the test suite the progress bar shows former line
endings if the new line is shorter than the former line. The length
was calculated without the line ending. It is now an empty string
to prevent the off by one error instead of using extra whitespace.

PR-URL: #24748
Refs: #24486
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
@BethGriggs BethGriggs mentioned this pull request Feb 12, 2019
rvagg pushed a commit that referenced this pull request Feb 28, 2019
PR-URL: #24486
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
rvagg pushed a commit that referenced this pull request Feb 28, 2019
PR-URL: #24748
Refs: #24486
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
rvagg pushed a commit that referenced this pull request Feb 28, 2019
While running the test suite the progress bar shows former line
endings if the new line is shorter than the former line. The length
was calculated without the line ending. It is now an empty string
to prevent the off by one error instead of using extra whitespace.

PR-URL: #24748
Refs: #24486
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
@refack refack removed their assignment Mar 11, 2019
BaochengSu pushed a commit to BaochengSu/node that referenced this pull request Oct 20, 2020
PR-URL: nodejs#24486
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
(cherry picked from commit b507783)
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. i18n-api Issues and PRs related to the i18n implementation. python PRs and issues that require attention from people who are familiar with Python. test Issues and PRs related to the tests. tools Issues and PRs related to the tools directory.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants