For windows users that use MINGW the shell scripts as still useful
(preferable to the .bat scripts) but they don't support symlink.
Add a little script for managing these entry points.
This change was mostly mechanically created by running this script.
Ubuntu 20.04 dropped the /usr/bin/python symlink so it is no longer
possible use `/usr/bin/env python` in launcher scripts and then
rely on python_selector.py to select a different python version.
Instead we go back to age-old method of using shell wrapper script.
Here I create a single wrapper script called run_python.sh which
runs a commmand under the best version of python it can find. Each
unsiffixed command is then a symbol link to this shell script. Since
windows users use the .bat files it shouldn't matter whether or not
these symlinks work on windows.
Fixes#10726
* introduces EMSCRIPTEN_ALLOW_NEWER_PYTHON to allow Python 3
* creates force_python_version.py to conditionally force Python 2
* separates colored logger as colored_logger.py
* uses emcc.py instead of emcc internally
* adds a test
* lets CircleCI test on Python 3 while Travis still tests on Python 2
When wrapper scripts em* in PATH are symlinks to the actual scripts
installed alongside em*.py (e.g. in the case of a Homebrew
installation), we need to resolve symlinks in order to find em*.py.
Most of these changes have to do with how python scripts are invoked.
For Linux, 'Popen([EMCC] + args)' works because the first line in emcc
is '#!/usr/bin/env python'. On Windows, the python interpreter has
to be explicitly invoked, e.g. 'Popen(['python', EMCC] + args)'. Note
that there is no harm in explicitly invoking the python interpreter
on Linux, so this works on both platforms.
For Windows, execvp() behaves differently than on Linux:
http://mail.python.org/pipermail/python-list/2002-July/763863.htmlhttp://msdn.microsoft.com/en-us/library/3xw6zy53.aspx
This causes many strange things to happen as the parent process
terminated before its children. In this change the use of execvp()
has been replaced with subprocess.call().
This change also fixes some code that assumed that the path separator
always is '/', but for Windows it is '\'. And where the path module
can be required, we use path.normalize() and path.resolve() to check
if a filename is absolute in a platform agnostic manner.