-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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: from io import StringIO in ninja.py #29371
Conversation
Aside: if you push fix-ups, it's easier for people to recognize them as such when you prefix them with Someone might come along now and be unsure whether the two commits in this PR need to be squashed first or merged separately. |
This happened on macOS platform too.There are other issues on macOS too. We may need to test more platform on JenkinsCI or travis. |
This file is only used when using Ninja, which I don't think any of our CI (Travis or Jenkins) uses. |
@gengjiawen If you are interested to spend some time on adding macOS and Windows to .travis.yml, you might take some inspiration from: https://docs.travis-ci.com/user/languages/python/#running-python-tests-on-multiple-operating-systems |
I mean we need to test Python3 compatibility in other Platform like macOS. Also the crash happened in config phase, Traceback (most recent call last):
File "./configure.py", line 1716, in <module>
run_gyp(gyp_args)
File "tools/gyp_node.py", line 54, in run_gyp
rc = gyp.main(args)
File "tools/gyp/pylib/gyp/__init__.py", line 547, in main
return gyp_main(args)
File "tools/gyp/pylib/gyp/__init__.py", line 523, in gyp_main
options.duplicate_basename_check)
File "tools/gyp/pylib/gyp/__init__.py", line 107, in Load
generator.CalculateVariables(default_variables, params)
File "tools/gyp/pylib/gyp/generator/make.py", line 81, in CalculateVariables
import gyp.generator.xcode as xcode_generator
File "tools/gyp/pylib/gyp/generator/xcode.py", line 10, in <module>
import gyp.xcode_ninja
File "tools/gyp/pylib/gyp/xcode_ninja.py", line 16, in <module>
import gyp.generator.ninja
File "tools/gyp/pylib/gyp/generator/ninja.py", line 23, in <module>
from cStringIO import StringIO
ModuleNotFoundError: No module named 'cStringIO'
|
That is the line that this PR fixes!! |
yeap, but on macOS will still failed with this patch, maybe add macOS to travisCI: Traceback (most recent call last):
File "./configure.py", line 1716, in <module>
run_gyp(gyp_args)
File "tools/gyp_node.py", line 54, in run_gyp
rc = gyp.main(args)
File "tools/gyp/pylib/gyp/__init__.py", line 547, in main
return gyp_main(args)
File "tools/gyp/pylib/gyp/__init__.py", line 523, in gyp_main
options.duplicate_basename_check)
File "tools/gyp/pylib/gyp/__init__.py", line 139, in Load
params['parallel'], params['root_targets'])
File "tools/gyp/pylib/gyp/input.py", line 2779, in Load
variables, includes, depth, check, True)
File "tools/gyp/pylib/gyp/input.py", line 459, in LoadTargetBuildFile
includes, depth, check, load_dependencies)
File "tools/gyp/pylib/gyp/input.py", line 408, in LoadTargetBuildFile
build_file_data, PHASE_EARLY, variables, build_file_path)
File "tools/gyp/pylib/gyp/input.py", line 1290, in ProcessVariablesAndConditionsInDict
build_file)
File "tools/gyp/pylib/gyp/input.py", line 1305, in ProcessVariablesAndConditionsInList
ProcessVariablesAndConditionsInDict(item, phase, variables, build_file)
File "tools/gyp/pylib/gyp/input.py", line 1264, in ProcessVariablesAndConditionsInDict
ProcessConditionsInDict(the_dict, phase, variables, build_file)
File "tools/gyp/pylib/gyp/input.py", line 1137, in ProcessConditionsInDict
build_file)
File "tools/gyp/pylib/gyp/input.py", line 1061, in EvalCondition
cond_expr, true_dict, false_dict, phase, variables, build_file)
File "tools/gyp/pylib/gyp/input.py", line 1087, in EvalSingleCondition
if eval(ast_code, {'__builtins__': None}, variables):
File "<string>", line 1, in <module>
TypeError: '>=' not supported between instances of 'int' and 'str' while loading dependencies of /Users/daniel/code/node/node.gyp while trying to load /Users/daniel/code/node/node.gyp
|
Landed in 020c2ea |
PR-URL: #29371 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This change broke
|
Allow both Python 2 and 3 to access StringIO. This fixes `./configure --ninja`, which was broken by #29371. See: #29371 (comment) PR-URL: #29414 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
PR-URL: #29371 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
PR-URL: #29371 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Allow both Python 2 and 3 to access StringIO. This fixes `./configure --ninja`, which was broken by #29371. See: #29371 (comment) PR-URL: #29414 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
cStringIO was removed in Python 3 so this PR advocates that we use the io module instead. As reported #25789 (comment), #29196 (comment), and #29236 (comment) this issue is being seen by Windows users who are experimenting with Python 3.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes