Repository navigation
Dependency v8 is not Python 3 compatible #24512
Description
Activity
PR has landed so I assume this can be closed. Comment (or re-open if GitHub allows) if I'm wrong about that! Thanks!!!
PR has landed so I assume this can be closed.
The files in
deps/v8andtools/inspector_protocol + jinja2 + markupsafewhere excluded from #24486. So this is still an issue.- addedv8 engineIssues and PRs related to the V8 dependency.Issues and PRs related to the V8 dependency.inspectorIssues and PRs related to the V8 inspector protocol.Issues and PRs related to the V8 inspector protocol.pythonPRs and issues that require attention from people who are familiar with Python.PRs and issues that require attention from people who are familiar with Python.toolsIssues and PRs related to the tools directory.Issues and PRs related to the tools directory.
on Nov 26, 2018 /CC @nodejs/v8 @nodejs/v8-inspector
FTR on 1.1.2020 Python 2 hits it's EOL https://pythonclock.org/
If you do not mind.
I would like to try to take up this task.
I'll try it this weekend. If I have any problems, I'll write.I definitely don't mind any contributions here. Do you have a list of scripts required by Node.js that need to be migrated?
There are now less that 400 days until the end of life of Python 2 (aka legacy Python). 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 has been a godsend to the JavaScript community but its Python code needs to be modernized, removed, or replaced with JavaScript, Go, etc. in the days remain until Python 2 end of life.
I would recommend that someone uses http://python-future.org to do the following:
- Run v8 tests on Python 2.7 and make sure they pass
- Drop commitment to support for all Python versions < 2.7 (they are EOL for 5+ years anyway)
- Run futurize -f libfuturize.fixes.fix_print_with_import -w . at the root of the v8 repo (print() function and new style imports for Python 3 v8/v8#26)
- Run v8 tests on Python 2.7 and make sure they pass
- Run futurize --stage1 -w . at the root of the v8 repo
- Run v8 tests on Python 2.7 and make sure they pass
- Run v8 tests on Python 3.7 in allow_failures mode and fix as you go...
Reacted by Andy Hayden, Jessica Franco and Kirill GroshkovDo you have a list of scripts required by Node.js that need to be migrated?
@hashseed I don't have that list. I was planning on finding it through the codebase. But if you provide it, it will be very cool.
@cclauss thank you very much for your clear recommendations. I will try to do it and provide for consideration.
@ak239 @bmsdave @hashseed Some low hanging fruit in the upstream inspector_protocol repo.
flake8 testing of https://chromium.googlesource.com/deps/inspector_protocol on Python 3.7.1
./check_protocol_compatibility.py:478:46: E999 SyntaxError: invalid syntax print " Public changes since %s:" % version ^ ./code_generator.py:43:18: F821 undefined name 'xrange' for i in xrange(len(keys)): ^ ./pdl.py:162:51: E999 SyntaxError: invalid syntax print 'Error in %s:%s, illegal token: \t%s' % (file_name, i, line) ^ 2 E999 SyntaxError: invalid syntax 1 F821 undefined name 'xrange' 3Reacted by Vadim Gorbachev48 remaining items
How can we solve this problem?
Will updating v8 to node.js solve it?
Or can I make changes to this part https://github.com/nodejs/node/tree/master/deps/v8?I don't really consider this a problem, because we don't use the scripts that are not compatible with Python 3.
If it is fixed at the V8 level (https://github.com/v8/v8), we will inherit that when we upgrade V8.
The next update will be to version 7.9: #30020https://github.com/v8/v8 passes these tests.
It's good that V8 itself is now compatible but other V8-related tools are not.
08:09:01 Failed to fetch file gs://chromium-clang-format/942fc8b1789144b8071d3fc03ff0fcbe1cf81ac8 for v8/buildtools/linux64/clang-format. [Err: gsutil requires python 2.6 or 2.7. 08:09:01 ] 08:09:01 0> Failed to fetch file gs://chromium-clang-format/942fc8b1789144b8071d3fc03ff0fcbe1cf81ac8 for v8/buildtools/linux64/clang-format, skipping. [Err: gsutil requires python 2.6 or 2.7.By looking at https://github.com/GoogleCloudPlatform/gsutil,
gsutilseems to support Python 3 so maybe the version used bydepot_toolsis too old?Should this issue stay open? I believe this issue is outdated as Node.js build chain is compatible with Python 3.
@nodejs/v8 @nodejs/build ... what do you think? There doesn't seem to be reason to keep this open?
This test would crash on Python 3 but that seem like a simple fix that is not on the critical path.
./test/debugging/wasm/gdb-server/gdb_rsp.py:35:14: F821 undefined name 'xrange' for i in xrange(int(timeout_in_seconds / poll_time_in_seconds)): ^ ./test/debugging/wasm/gdb-server/gdb_rsp.py:67:8: F821 undefined name 'sys' if sys.platform == 'win32': ^The issue is still valid. V8 build tools are not yet all compatible with Python 3:
$ gclient sync Warning: Running gclient on Python 3. If you encounter any issues, please file a bug on crbug.com under the Infra>SDK component. Syncing projects: 100% (28/28), done. ________ running 'vpython v8/third_party/depot_tools/update_depot_tools_toggle.py --disable' in '/home/mzasso/git/chromium/v8' [E2020-04-28T19:19:27.955163+02:00 229437 0 annotate.go:241] goroutine 1: [E2020-04-28T19:19:27.955189+02:00 229437 0 annotate.go:241] #0 go.chromium.org/luci/vpython/python/find.go:93 - python.Find() [E2020-04-28T19:19:27.955199+02:00 229437 0 annotate.go:241] annotation #0: [E2020-04-28T19:19:27.955205+02:00 229437 0 annotate.go:241] reason: no Python found [E2020-04-28T19:19:27.955210+02:00 229437 0 annotate.go:241] annotation #1: [E2020-04-28T19:19:27.955215+02:00 229437 0 annotate.go:241] reason: could not find appropriate executable for: "python2.7"I don't know if we should keep this open though, there's nothing we can do about it in Node.js.
IMO that should be tracked upstream, unless Node.js folks are actively working with V8 and Chromium to make the tools Python 3-compatible. Otherwise, as @targos mentioned, there's nothing we can do on our side.
It's also not a huge deal since it only affects folks building V8 through make-v8, which is limited to a subset of collaborators working on V8 upgrades on Node.js.
@targos, What happens when you add the 3??
vpython3 v8/third_party/depot_tools/update_depot_tools_toggle.py --disable' in '/home/mzasso/git/chromium/v8' ^@cclauss nothing is printed, exits with code 0
Reacted by Christian ClaussAgreed with @targos and @mmarchini that this issue should be tracked upstream.
Reacted by Avindra Goolcharan
The open bug reports on chromium.org:
https://bugs.chromium.org/p/chromium/issues/detail?id=914950@bmsdave commit to upstream: #24512 (comment)