Make installation errors fatal (#437)
If `is_installed` doesn't return true after install than something serious went wrong so make this into a warning. Also, clean up couple of places to make the python code more readable.
This commit is contained in:
32
emsdk.py
32
emsdk.py
@@ -1397,7 +1397,8 @@ def get_required_path(active_tools):
|
|||||||
path_add = [to_native_path(emsdk_path())]
|
path_add = [to_native_path(emsdk_path())]
|
||||||
for tool in active_tools:
|
for tool in active_tools:
|
||||||
if hasattr(tool, 'activated_path'):
|
if hasattr(tool, 'activated_path'):
|
||||||
path_add += [to_native_path(tool.expand_vars(tool.activated_path))]
|
path = to_native_path(tool.expand_vars(tool.activated_path))
|
||||||
|
path_add.append(path)
|
||||||
return path_add
|
return path_add
|
||||||
|
|
||||||
|
|
||||||
@@ -1685,13 +1686,13 @@ class Tool(object):
|
|||||||
# clang-master-64bit, clang-master-32bit and clang-master-64bit each
|
# clang-master-64bit, clang-master-32bit and clang-master-64bit each
|
||||||
# share the same git repo), require that in addition to the installation
|
# share the same git repo), require that in addition to the installation
|
||||||
# directory, each item in the activated PATH must exist.
|
# directory, each item in the activated PATH must exist.
|
||||||
activated_path = self.expand_vars(self.activated_path).split(';') if hasattr(self, 'activated_path') else [self.installation_path()]
|
if hasattr(self, 'activated_path'):
|
||||||
|
activated_path = self.expand_vars(self.activated_path).split(';')
|
||||||
|
else:
|
||||||
|
activated_path = [self.installation_path()]
|
||||||
|
|
||||||
def each_path_exists(pathlist):
|
def each_path_exists(pathlist):
|
||||||
for path in pathlist:
|
return all(os.path.exists(p) for p in pathlist)
|
||||||
if not os.path.exists(path):
|
|
||||||
return False
|
|
||||||
return True
|
|
||||||
|
|
||||||
content_exists = os.path.exists(self.installation_path()) and each_path_exists(activated_path) and (os.path.isfile(self.installation_path()) or num_files_in_directory(self.installation_path()) > 0)
|
content_exists = os.path.exists(self.installation_path()) and each_path_exists(activated_path) and (os.path.isfile(self.installation_path()) or num_files_in_directory(self.installation_path()) > 0)
|
||||||
|
|
||||||
@@ -1919,7 +1920,9 @@ class Tool(object):
|
|||||||
with open(version_file_path, 'w') as version_file:
|
with open(version_file_path, 'w') as version_file:
|
||||||
version_file.write(version_id)
|
version_file.write(version_id)
|
||||||
else:
|
else:
|
||||||
print("Warning: The installation of '" + str(self) + "' seems to have failed, but no error was detected. Either something went wrong with the installation, or this may indicate an internal emsdk error.")
|
print("Installation of '" + str(self) + "' failed, but no error was detected. Either something went wrong with the installation, or this may indicate an internal emsdk error.")
|
||||||
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def cleanup_temp_install_files(self):
|
def cleanup_temp_install_files(self):
|
||||||
@@ -2567,22 +2570,23 @@ def adjusted_path(tools_to_activate, log_additions=False, system_path_only=False
|
|||||||
existing_path = os.environ['PATH'].split(ENVPATH_SEPARATOR)
|
existing_path = os.environ['PATH'].split(ENVPATH_SEPARATOR)
|
||||||
emsdk_root_path = to_unix_path(emsdk_path())
|
emsdk_root_path = to_unix_path(emsdk_path())
|
||||||
|
|
||||||
existing_emsdk_tools = [item for item in existing_path if to_unix_path(item).startswith(emsdk_root_path)]
|
existing_emsdk_tools = [i for i in existing_path if to_unix_path(i).startswith(emsdk_root_path)]
|
||||||
new_emsdk_tools = [item for item in path_add if not normalized_contains(existing_emsdk_tools, item)]
|
new_emsdk_tools = [i for i in path_add if not normalized_contains(existing_emsdk_tools, i)]
|
||||||
|
|
||||||
# Existing non-emsdk tools
|
# Existing non-emsdk tools
|
||||||
existing_path = [item for item in existing_path if not to_unix_path(item).startswith(emsdk_root_path)]
|
existing_path = [i for i in existing_path if not to_unix_path(i).startswith(emsdk_root_path)]
|
||||||
new_path = [item for item in path_add if not normalized_contains(existing_path, item)]
|
new_path = [i for i in path_add if not normalized_contains(existing_path, i)]
|
||||||
whole_path = unique_items(new_path + existing_path)
|
whole_path = unique_items(new_path + existing_path)
|
||||||
if MSYS:
|
if MSYS:
|
||||||
# XXX Hack: If running native Windows Python in MSYS prompt where PATH
|
# XXX Hack: If running native Windows Python in MSYS prompt where PATH
|
||||||
# entries look like "/c/Windows/System32", os.environ['PATH']
|
# entries look like "/c/Windows/System32", os.environ['PATH']
|
||||||
# in Python will transform to show them as "C:\\Windows\\System32", so need
|
# in Python will transform to show them as "C:\\Windows\\System32", so need
|
||||||
# to reconvert path delimiter back to forward slashes.
|
# to reconvert path delimiter back to forward slashes.
|
||||||
whole_path = list(map(to_msys_path, whole_path))
|
whole_path = [to_msys_path(p) for p in whole_path]
|
||||||
new_emsdk_tools = list(map(to_msys_path, new_emsdk_tools))
|
new_emsdk_tools = [to_msys_path(p) for p in new_emsdk_tools]
|
||||||
|
|
||||||
return ((':' if MSYS else ENVPATH_SEPARATOR).join(whole_path), new_emsdk_tools)
|
separator = ':' if MSYS else ENVPATH_SEPARATOR
|
||||||
|
return (separator.join(whole_path), new_emsdk_tools)
|
||||||
|
|
||||||
|
|
||||||
def construct_env(tools_to_activate, permanent):
|
def construct_env(tools_to_activate, permanent):
|
||||||
|
|||||||
Reference in New Issue
Block a user