Skip to content
Snippets Groups Projects

Local itk-vtk-viewer

1 file
+ 13
4
Compare changes
  • Side-by-side
  • Inline
@@ -35,6 +35,8 @@ class Installer:
def _run_for_platform(self, linux, mac, windows):
if self.platform == LINUX:
return linux()
elif self.platform == WINDOWS:
return windows()
else:
raise NotImplementedError
@@ -57,7 +59,7 @@ class Installer:
self.nvm_dir = self.qim_nvm_dir
return not bool(output.stderr) # If there is an error running the above command then it is not installed (not in expected location)
return self._run_for_platform(_linux, None, None)
return self._run_for_platform(_linux, lambda x: False, lambda x: False)
@property
def is_node_already_installed(self) -> bool:
@@ -73,7 +75,7 @@ class Installer:
output = subprocess.run(command, shell = True, capture_output = True)
return not bool(output.stderr)
return self._run_for_platform(_linux, None, None)
return self._run_for_platform(_linux, lambda x: False, lambda x: False)
def install(self):
@@ -101,8 +103,12 @@ class Installer:
def _linux():
_ = subprocess.run([F'export NVM_DIR={self.nvm_dir} && bash {self.dir.joinpath("install_nvm.sh")}'], shell = True, capture_output=True)
def _windows():
subprocess.run('winget install Schniz.fnm', shell = True)
subprocess.run('fnm env --use-on-cd | Out-String | Invoke-Expression', shell = True)
print(F'Installing NVM into {self.nvm_dir}...')
self._run_for_platform(_linux, None, None)
self._run_for_platform(_linux, None, _windows)
print("NVM installed")
def install_node(self):
@@ -124,9 +130,12 @@ class Installer:
command = f'{prefix}/bin/bash -c "source {nvmsh} && nvm install 22"'
output = subprocess.run(command, shell = True, capture_output=True)
print(output.stderr)
def _windows():
subprocess.run('fnm use --install-if-missing 22')
print(F'Installing node.js into {self.nvm_dir}...')
self._run_for_platform(_linux, None, None)
self._run_for_platform(_linux, None, _windows)
print("Node.js installed")
def install_viewer(self):
Loading