From cf90c72aba3e09ffd96d90a6fdf87095ed5351b8 Mon Sep 17 00:00:00 2001 From: juj Date: Thu, 5 Dec 2019 17:59:21 +0200 Subject: [PATCH] Do not attempt to reinstall python if it already exists (#394) * Do not attempt to reinstall python if it already exists, since that python may be interpreting the current emsdk.py script that is being executed to do the installation. * Add TODO comment about refactoring install scheme --- emsdk.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/emsdk.py b/emsdk.py index 10e1843..d8ba580 100755 --- a/emsdk.py +++ b/emsdk.py @@ -1698,6 +1698,15 @@ class Tool(object): print("Done installing SDK '" + str(self) + "'.") return True else: + # 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 + # lead to a failure to uncompress the python zip file as the python executable files are in use. + # TODO: Refactor codebase to avoid needing this kind of special case check by being more + # careful about reinstallation, see https://github.com/emscripten-core/emsdk/pull/394#issuecomment-559386468 + # for a scheme that would work. + if self.id == 'python' and self.is_installed(): + print("Skipped installing " + self.name + ", already installed.") + return True print("Installing tool '" + str(self) + "'..") url = self.download_url()