Remove support for non-embedded mode (#510)

embedded mode as been the default since #472 and I included
`--no-embedded` as an option during the interim time, but to simply
the code and avoid have two modes of operation I think its safe
to now remove the non-embedded mode.
This commit is contained in:
Sam Clegg 2020-07-20 13:39:21 -07:00 коммит произвёл GitHub
Родитель dec8a63594
Коммит 3e9f04d467
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 22 добавлений и 54 удалений

Просмотреть файл

@ -20,7 +20,6 @@ import stat
import subprocess
import sys
import sysconfig
import tempfile
import zipfile
if sys.version_info >= (3,):
@ -164,11 +163,6 @@ def emsdk_path():
return to_unix_path(os.path.dirname(os.path.realpath(__file__)))
emscripten_config_directory = os.path.expanduser("~/")
# If .emscripten exists, we are configuring as embedded inside the emsdk directory.
if os.path.exists(os.path.join(emsdk_path(), '.emscripten')):
emscripten_config_directory = emsdk_path()
EMSDK_SET_ENV = ""
if POWERSHELL:
EMSDK_SET_ENV = os.path.join(emsdk_path(), 'emsdk_set_env.ps1')
@ -1409,7 +1403,7 @@ def get_required_path(active_tools):
# Returns the absolute path to the file '.emscripten' for the current user on
# this system.
def dot_emscripten_path():
return os.path.join(emscripten_config_directory, ".emscripten")
return os.path.join(emsdk_path(), ".emscripten")
dot_emscripten = {}
@ -1445,20 +1439,11 @@ def load_dot_emscripten():
def generate_dot_emscripten(active_tools):
global emscripten_config_directory
if emscripten_config_directory == emsdk_path():
temp_dir = sdk_path('tmp')
mkdir_p(temp_dir)
embedded = True
else:
temp_dir = tempfile.gettempdir().replace('\\', '/')
embedded = False
temp_dir = sdk_path('tmp')
mkdir_p(temp_dir)
cfg = ''
if embedded:
cfg += 'import os\n'
cfg += "emsdk_path = os.path.dirname(os.environ.get('EM_CONFIG')).replace('\\\\', '/')\n"
cfg = 'import os\n'
cfg += "emsdk_path = os.path.dirname(os.environ.get('EM_CONFIG')).replace('\\\\', '/')\n"
# Different tools may provide the same activated configs; the latest to be
# activated is the relevant one.
@ -1482,8 +1467,7 @@ COMPILER_ENGINE = NODE_JS
JS_ENGINES = [NODE_JS]
''' % temp_dir
if embedded:
cfg = cfg.replace("'" + emscripten_config_directory, "emsdk_path + '")
cfg = cfg.replace("'" + emsdk_path(), "emsdk_path + '")
if os.path.exists(dot_emscripten_path()):
backup_path = dot_emscripten_path() + ".old"
@ -1495,7 +1479,7 @@ JS_ENGINES = [NODE_JS]
# Clear old emscripten content.
try:
os.remove(os.path.join(emscripten_config_directory, ".emscripten_sanity"))
os.remove(os.path.join(emsdk_path(), ".emscripten_sanity"))
except:
pass
@ -1758,8 +1742,8 @@ class Tool(object):
debug_print(str(self) + ' is not active, because key="' + key + '" does not exist in .emscripten')
return False
# If running in embedded mode, all paths are stored dynamically relative
# to the emsdk root, so normalize those first.
# all paths are stored dynamically relative to the emsdk root, so
# normalize those first.
dot_emscripten_key = dot_emscripten[key].replace("emsdk_path + '", "'" + emsdk_path())
dot_emscripten_key = dot_emscripten_key.strip("'")
if dot_emscripten_key != value:
@ -2683,7 +2667,7 @@ def error_on_missing_tool(name):
def main():
global emscripten_config_directory, BUILD_FOR_TESTING, ENABLE_LLVM_ASSERTIONS, TTY_OUTPUT
global BUILD_FOR_TESTING, ENABLE_LLVM_ASSERTIONS, TTY_OUTPUT
if len(sys.argv) <= 1:
print("Missing command; Type 'emsdk help' to get a list of commands.")
@ -2768,18 +2752,13 @@ def main():
if WINDOWS:
print('''
emsdk activate [--global] [--[no-]embedded] [--build=type] [--vs2017/--vs2019] <tool/sdk>
emsdk activate [--global] [--build=type] [--vs2017/--vs2019] <tool/sdk>
- Activates the given tool or SDK in the
environment of the current shell. If the
--global option is passed, the registration
is done globally to all users in the system
environment. In embedded mode (the default)
all Emcripten configuration files as well as
the temp, cache and ports directories
are located inside the Emscripten SDK
directory rather than the user home
directory. If a custom compiler version was
environment. If a custom compiler version was
used to override the compiler to use, pass
the same --vs2017/--vs2019 parameter
here to choose which version to activate.
@ -2787,15 +2766,10 @@ def main():
emcmdprompt.bat - Spawns a new command prompt window with the
Emscripten environment active.''')
else:
print(''' emsdk activate [--[no-]embedded] [--build=type] <tool/sdk>
print(''' emsdk activate [--build=type] <tool/sdk>
- Activates the given tool or SDK in the
environment of the current shell. In
embedded mode (the default), all Emcripten
configuration files as well as the temp, cache
and ports directories are located inside the
Emscripten SDK directory rather than the user
home directory.''')
environment of the current shell.''')
print('''
Both commands 'install' and 'activate' accept an optional parameter
@ -2817,8 +2791,12 @@ def main():
arg_old = extract_bool_arg('--old')
arg_uses = extract_bool_arg('--uses')
arg_global = extract_bool_arg('--global')
arg_embedded = extract_bool_arg('--embedded')
arg_embedded = not extract_bool_arg('--no-embedded')
if extract_bool_arg('--embedded'):
print('embedded mode is now the only mode available', file=sys.stderr)
if extract_bool_arg('--no-embedded'):
print('embedded mode is now the only mode available', file=sys.stderr)
return 1
arg_notty = extract_bool_arg('--notty')
if arg_notty:
TTY_OUTPUT = False
@ -3047,18 +3025,8 @@ def main():
if arg_global:
print('Registering active Emscripten environment globally for all users.')
print('')
if arg_embedded:
# Activating the emsdk tools locally relative to Emscripten SDK directory.
emscripten_config_directory = emsdk_path()
print('Writing .emscripten configuration file to Emscripten SDK directory ' + emscripten_config_directory)
else:
print('Writing .emscripten configuration file to user home directory ' + emscripten_config_directory)
# Remove .emscripten from emsdk dir, since its presence is used to detect
# whether emsdk is activate in embedded mode or not.
try:
os.remove(os.path.join(emsdk_path(), ".emscripten"))
except:
pass
print('Writing .emscripten configuration file in ' + emsdk_path())
tools_to_activate = currently_active_tools()
args = [x for x in sys.argv[2:] if not x.startswith('--')]