From 79cf18d531a5f4291170da5320e3309481002c12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jukka=20Jyl=C3=A4nki?= Date: Tue, 18 Nov 2014 19:02:12 +0200 Subject: [PATCH] Fix UI print issue where different clang git repository tools would not correctly print if they are installed or not. Fixes #21. --- emsdk | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/emsdk b/emsdk index 9f335a5..db751b1 100755 --- a/emsdk +++ b/emsdk @@ -696,7 +696,16 @@ class Tool: return False if self.download_url() != None: - content_exists = os.path.exists(self.installation_path()) and (os.path.isfile(self.installation_path()) or num_files_in_directory(self.installation_path()) > 0) + # For e.g. fastcomp clang from git repo, the activated PATH is the directory where the compiler is built to, and installation_path is + # the directory where the source tree exists. To distinguish between multiple packages sharing the same source + # (clang-master-32bit, clang-master-64bit, clang-incoming-32bit and clang-incoming-64bit each share the same git repo), require + # that in addition to the installation 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()] + def each_path_exists(pathlist): + for path 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) if self.id == 'vs-tool': # vs-tool is a special tool since all versions must be installed to the same dir, so dir name will not differentiate the version. return content_exists and get_installed_vstool_version(self.installation_path()) == self.version