-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Remove python_selector.py in favor of run_python.sh #10729
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
tools/run_python.sh |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,17 @@ | ||
#!/usr/bin/env python | ||
#!/usr/bin/env python3 | ||
# Copyright 2011 The Emscripten Authors. All rights reserved. | ||
# Emscripten is available under two separate licenses, the MIT license and the | ||
# University of Illinois/NCSA Open Source License. Both these licenses can be | ||
# found in the LICENSE file. | ||
|
||
# This script should work in python 2 *or* 3. It loads the main code using | ||
# python_selector, which may pick a different version. | ||
# It also tells emcc.py that we want C++ and not C by default | ||
|
||
import os | ||
import sys | ||
from tools import python_selector | ||
import emcc | ||
|
||
sys.argv += ['--emscripten-cxx'] | ||
|
||
emcc = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'emcc') | ||
if __name__ == '__main__': | ||
python_selector.run(emcc) | ||
try: | ||
sys.exit(emcc.run(sys.argv)) | ||
except KeyboardInterrupt: | ||
emcc.logger.warning('KeyboardInterrupt') | ||
sys.exit(1) |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
tools/run_python.sh |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
tools/run_python.sh |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
tools/run_python.sh |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
tools/run_python.sh |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
tools/run_python.sh |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
tools/run_python.sh |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
tools/run_python.sh |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
tools/run_python.sh |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2464,12 +2464,12 @@ def test_mmap_file(self): | |
def test_emrun_info(self): | ||
if not has_browser(): | ||
self.skipTest('need a browser') | ||
result = run_process([PYTHON, path_from_root('emrun'), '--system_info', '--browser_info'], stdout=PIPE).stdout | ||
result = run_process([PYTHON, path_from_root('emrun.py'), '--system_info', '--browser_info'], stdout=PIPE).stdout | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this change necessary? if it is that seems like a breaking change. if it isn't then why? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes this change is a slightly breaking change. You can no longer run I think this is the best approach. The python_selector method where python re-invokes itself is kind of nasty. If I run There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sgtm. is there some way we can show a clear error on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not deleting those files. They are now symbolic links to I'm not sure we can have |
||
assert 'CPU' in result | ||
assert 'Browser' in result | ||
assert 'Traceback' not in result | ||
|
||
result = run_process([PYTHON, path_from_root('emrun'), '--list_browsers'], stdout=PIPE).stdout | ||
result = run_process([PYTHON, path_from_root('emrun.py'), '--list_browsers'], stdout=PIPE).stdout | ||
assert 'Traceback' not in result | ||
|
||
# Deliberately named as test_zzz_emrun to make this test the last one | ||
|
@@ -2484,7 +2484,7 @@ def test_zzz_emrun(self): | |
# and the browser will not close as part of the test, pinning down the cwd on Windows and it wouldn't be possible to delete it. Therefore switch away from that directory | ||
# before launching. | ||
os.chdir(path_from_root()) | ||
args_base = [PYTHON, path_from_root('emrun'), '--timeout', '30', '--safe_firefox_profile', '--kill_exit', '--port', '6939', '--verbose', '--log_stdout', os.path.join(outdir, 'stdout.txt'), '--log_stderr', os.path.join(outdir, 'stderr.txt')] | ||
args_base = [PYTHON, path_from_root('emrun.py'), '--timeout', '30', '--safe_firefox_profile', '--kill_exit', '--port', '6939', '--verbose', '--log_stdout', os.path.join(outdir, 'stdout.txt'), '--log_stderr', os.path.join(outdir, 'stderr.txt')] | ||
if EMTEST_BROWSER is not None: | ||
# If EMTEST_BROWSER carried command line arguments to pass to the browser, | ||
# (e.g. "firefox -profile /path/to/foo") those can't be passed via emrun, | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
run_python.sh |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/sh | ||
# Copyright 2011 The Emscripten Authors. All rights reserved. | ||
# Emscripten is available under two separate licenses, the MIT license and the | ||
# University of Illinois/NCSA Open Source License. Both these licenses can be | ||
# found in the LICENSE file. | ||
# | ||
# Entpy point for running python scripts on UNIX systems. | ||
|
||
if [ -z $PYTHON ]; then | ||
PYTHON=$(which python3) | ||
fi | ||
|
||
if [ -z $PYTHON ]; then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that it's possible for Python to be installed in a path with spaces, which breaks this line: #11005 |
||
PYTHON=$(which python) | ||
fi | ||
|
||
if [ -z $PYTHON ]; then | ||
PYTHON=$(which python2) | ||
fi | ||
|
||
if [ -z $PYTHON ]; then | ||
print 'unable to find python in $PATH' | ||
exit 1 | ||
fi | ||
|
||
exec $PYTHON "$0.py" "$@" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is em++.py special among the tools? seems like it's getting different treatment in this PR than the others and it's not obvious why.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because em++ was using the python_selector in a slightly different way. It was using it to redirect to emcc.py as well as to choose the python version.
With this change, once python is running we assume its the correct version, we never try to re-invoke python. So this change means that em++ now runs emcc directly, without re-invoking python.