Extract install_sdk and install_tool from install. NFC (#432)
This change simply splits this function into its two logical parts.
This commit is contained in:
12
emsdk.py
12
emsdk.py
@@ -1842,7 +1842,13 @@ class Tool(object):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
if self.id == 'sdk':
|
if self.id == 'sdk':
|
||||||
|
return self.install_sdk()
|
||||||
|
else:
|
||||||
|
return self.install_tool()
|
||||||
|
|
||||||
|
def install_sdk(self):
|
||||||
print("Installing SDK '" + str(self) + "'..")
|
print("Installing SDK '" + str(self) + "'..")
|
||||||
|
|
||||||
for tool_name in self.uses:
|
for tool_name in self.uses:
|
||||||
tool = find_tool(tool_name)
|
tool = find_tool(tool_name)
|
||||||
if tool is None:
|
if tool is None:
|
||||||
@@ -1856,9 +1862,11 @@ class Tool(object):
|
|||||||
success = emscripten_npm_install(self, os.path.join(emsdk_path(), install_path, 'emscripten'))
|
success = emscripten_npm_install(self, os.path.join(emsdk_path(), install_path, 'emscripten'))
|
||||||
if not success:
|
if not success:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
print("Done installing SDK '" + str(self) + "'.")
|
print("Done installing SDK '" + str(self) + "'.")
|
||||||
return True
|
return True
|
||||||
else:
|
|
||||||
|
def install_tool(self):
|
||||||
# We should not force reinstallation of python if it already exists, since that very python
|
# We should not force reinstallation of python if it already exists, since that very python
|
||||||
# may be interpreting the current emsdk.py script we are executing. On Windows this would
|
# may be interpreting the current emsdk.py script we are executing. On Windows this would
|
||||||
# lead to a failure to uncompress the python zip file as the python executable files are in use.
|
# lead to a failure to uncompress the python zip file as the python executable files are in use.
|
||||||
@@ -1868,6 +1876,7 @@ class Tool(object):
|
|||||||
if self.id == 'python' and self.is_installed():
|
if self.id == 'python' and self.is_installed():
|
||||||
print("Skipped installing " + self.name + ", already installed.")
|
print("Skipped installing " + self.name + ", already installed.")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
print("Installing tool '" + str(self) + "'..")
|
print("Installing tool '" + str(self) + "'..")
|
||||||
url = self.download_url()
|
url = self.download_url()
|
||||||
|
|
||||||
@@ -1921,6 +1930,7 @@ class Tool(object):
|
|||||||
if not success:
|
if not success:
|
||||||
print("Installation failed!")
|
print("Installation failed!")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
print("Done installing tool '" + str(self) + "'.")
|
print("Done installing tool '" + str(self) + "'.")
|
||||||
|
|
||||||
# Sanity check that the installation succeeded, and if so, remove unneeded
|
# Sanity check that the installation succeeded, and if so, remove unneeded
|
||||||
|
|||||||
Reference in New Issue
Block a user