From 9acd6b3447dfb6130816c18cf2ef88eb290e4829 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Tue, 17 Apr 2018 17:40:11 +0200 Subject: [PATCH] Run the xcodebuild command only we actually use iOSTargetInfo. --- kiwixbuild/__init__.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/kiwixbuild/__init__.py b/kiwixbuild/__init__.py index ec91338..a5ea5fb 100644 --- a/kiwixbuild/__init__.py +++ b/kiwixbuild/__init__.py @@ -238,8 +238,14 @@ class iOSTargetInfo(TargetInfo): hosts=['Darwin']) self.arch = arch self.arch_full, self.cpu, self.sdk_name = self.__arch_infos[arch] - command = "xcodebuild -version -sdk {} | grep -E '^Path' | sed 's/Path: //'".format(self.sdk_name) - self.root_path = subprocess.check_output(command, shell=True)[:-1].decode() + self._root_path = None + + @property + def root_path(self): + if self._root_path is None: + command = "xcodebuild -version -sdk {} | grep -E '^Path' | sed 's/Path: //'".format(self.sdk_name) + self._root_path = subprocess.check_output(command, shell=True)[:-1].decode() + return self._root_path def __str__(self): return "iOS"