28
emsdk
28
emsdk
@@ -6,13 +6,31 @@
|
|||||||
|
|
||||||
# Wrapper script that runs emsdk.py
|
# Wrapper script that runs emsdk.py
|
||||||
|
|
||||||
|
# First look for pre-built python (macos)
|
||||||
if [ -z "$EMSDK_PYTHON" ]; then
|
if [ -z "$EMSDK_PYTHON" ]; then
|
||||||
# Look for python3 first. This is especially important on macOS (See:
|
PYTHON3=$(dirname $0)/python/3.7.4-2_64bit/bin/python3
|
||||||
# https://github.com/emscripten-core/emsdk/pull/273)
|
if [ -e $PYTHON3 ]; then
|
||||||
EMSDK_PYTHON=$(which python3 2> /dev/null)
|
EMSDK_PYTHON=$PYTHON3
|
||||||
if [ $? != 0 ]; then
|
# When using our bundled python we never want the users
|
||||||
EMSDK_PYTHON=python
|
# PYTHONHOME or PYTHONPATH
|
||||||
|
# https://github.com/emscripten-core/emsdk/issues/598
|
||||||
|
unset PYTHONHOME
|
||||||
|
unset PYTHONPATH
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Look for `python3` first. This is especially important on macOS (See:
|
||||||
|
# https://github.com/emscripten-core/emsdk/pull/273)
|
||||||
|
if [ -z "$EMSDK_PYTHON" ]; then
|
||||||
|
PYTHON3=$(which python3 2> /dev/null)
|
||||||
|
if [ $? = 0 ]; then
|
||||||
|
EMSDK_PYTHON=$PYTHON3
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Finally fall back to just looking for `python` in PATH
|
||||||
|
if [ -z "$EMSDK_PYTHON" ]; then
|
||||||
|
EMSDK_PYTHON=python
|
||||||
|
fi
|
||||||
|
|
||||||
exec "$EMSDK_PYTHON" "$0.py" "$@"
|
exec "$EMSDK_PYTHON" "$0.py" "$@"
|
||||||
|
|||||||
34
emsdk.bat
34
emsdk.bat
@@ -6,41 +6,25 @@ setlocal
|
|||||||
|
|
||||||
if exist "%~dp0python\3.7.4-pywin32_64bit\python.exe" (
|
if exist "%~dp0python\3.7.4-pywin32_64bit\python.exe" (
|
||||||
set EMSDK_PY="%~dp0python\3.7.4-pywin32_64bit\python.exe"
|
set EMSDK_PY="%~dp0python\3.7.4-pywin32_64bit\python.exe"
|
||||||
|
:: When using our bundled python we never want the users
|
||||||
|
:: PYTHONHOME or PYTHONPATH
|
||||||
|
:: https://github.com/emscripten-core/emsdk/issues/598
|
||||||
|
set PYTHONHOME=
|
||||||
|
set PYTHONPATH=
|
||||||
goto end
|
goto end
|
||||||
)
|
)
|
||||||
|
|
||||||
if exist "%~dp0python\3.7.4_64bit\python.exe" (
|
if exist "%~dp0python\3.7.4_64bit\python.exe" (
|
||||||
set EMSDK_PY="%~dp0python\3.7.4_64bit\python.exe"
|
set EMSDK_PY="%~dp0python\3.7.4_64bit\python.exe"
|
||||||
|
set PYTHONHOME=
|
||||||
|
set PYTHONPATH=
|
||||||
goto end
|
goto end
|
||||||
)
|
)
|
||||||
|
|
||||||
if exist "%~dp0python\2.7.13.1_64bit\python-2.7.13.amd64\python.exe" (
|
if exist "%~dp0python\2.7.13.1_64bit\python-2.7.13.amd64\python.exe" (
|
||||||
set EMSDK_PY="%~dp0python\2.7.13.1_64bit\python-2.7.13.amd64\python.exe"
|
set EMSDK_PY="%~dp0python\2.7.13.1_64bit\python-2.7.13.amd64\python.exe"
|
||||||
goto end
|
set PYTHONHOME=
|
||||||
)
|
set PYTHONPATH=
|
||||||
|
|
||||||
if exist "%~dp0python\2.7.13.1_32bit\python-2.7.13\python.exe" (
|
|
||||||
set EMSDK_PY="%~dp0python\2.7.13.1_32bit\python-2.7.13\python.exe"
|
|
||||||
goto end
|
|
||||||
)
|
|
||||||
|
|
||||||
if exist "%~dp0python\2.7.5.3_64bit\python.exe" (
|
|
||||||
set EMSDK_PY="%~dp0python\2.7.5.3_64bit\python.exe"
|
|
||||||
goto end
|
|
||||||
)
|
|
||||||
|
|
||||||
if exist "%~dp0python\2.7.5.3_32bit\python.exe" (
|
|
||||||
set EMSDK_PY="%~dp0python\2.7.5.3_32bit\python.exe"
|
|
||||||
goto end
|
|
||||||
)
|
|
||||||
|
|
||||||
if exist "%~dp0python\2.7.5_64bit\python.exe" (
|
|
||||||
set EMSDK_PY="%~dp0python\2.7.5_64bit\python.exe"
|
|
||||||
goto end
|
|
||||||
)
|
|
||||||
|
|
||||||
if exist "%~dp0python\2.7.5.1_32bit\python.exe" (
|
|
||||||
set EMSDK_PY="%~dp0python\2.7.5.1_32bit\python.exe"
|
|
||||||
goto end
|
goto end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
19
emsdk.py
19
emsdk.py
@@ -2575,6 +2575,25 @@ def construct_env(tools_to_activate):
|
|||||||
env_string += 'export ' + key + '="' + value + '";\n'
|
env_string += 'export ' + key + '="' + value + '";\n'
|
||||||
else:
|
else:
|
||||||
assert False
|
assert False
|
||||||
|
if 'EMSDK_PYTHON' in env_vars:
|
||||||
|
# When using our bundled python we never want the user's
|
||||||
|
# PYTHONHOME or PYTHONPATH
|
||||||
|
# See https://github.com/emscripten-core/emsdk/issues/598
|
||||||
|
if POWERSHELL:
|
||||||
|
env_string += 'Remove-Item env:PYTHONHOME\n'
|
||||||
|
env_string += 'Remove-Item env:PYTHONPATH\n'
|
||||||
|
elif CMD:
|
||||||
|
env_string += 'set PYTHONHOME=\n'
|
||||||
|
env_string += 'set PYTHONPATH=\n'
|
||||||
|
elif CSH:
|
||||||
|
env_string += 'unsetenv PYTHONHOME\n'
|
||||||
|
env_string += 'unsetenv PYTHONPATH\n'
|
||||||
|
elif BASH:
|
||||||
|
env_string += 'unset PYTHONHOME\n'
|
||||||
|
env_string += 'unset PYTHONPATH\n'
|
||||||
|
else:
|
||||||
|
assert False
|
||||||
|
|
||||||
errlog(key + ' = ' + value)
|
errlog(key + ' = ' + value)
|
||||||
return env_string
|
return env_string
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,13 @@ def check_call(cmd, **args):
|
|||||||
def checked_call_with_output(cmd, expected=None, unexpected=None, stderr=None):
|
def checked_call_with_output(cmd, expected=None, unexpected=None, stderr=None):
|
||||||
cmd = cmd.split(' ')
|
cmd = cmd.split(' ')
|
||||||
print('running: %s' % cmd)
|
print('running: %s' % cmd)
|
||||||
stdout = subprocess.check_output(cmd, stderr=stderr, universal_newlines=True)
|
try:
|
||||||
|
stdout = subprocess.check_output(cmd, stderr=stderr, universal_newlines=True)
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
print(e.stderr)
|
||||||
|
print(e.stdout)
|
||||||
|
raise e
|
||||||
|
|
||||||
if expected:
|
if expected:
|
||||||
for x in listify(expected):
|
for x in listify(expected):
|
||||||
assert x in stdout, 'call had the right output: ' + stdout + '\n[[[' + x + ']]]'
|
assert x in stdout, 'call had the right output: ' + stdout + '\n[[[' + x + ']]]'
|
||||||
|
|||||||
Reference in New Issue
Block a user