@@ -31,28 +31,6 @@ def parse_version(version_str):
3131 return [int (x ) for x in re .findall (r'(\d+)' , version_str )]
3232
3333
34- def run_command_with_retry (command , timeout = 10 , retries = 3 ):
35- """
36- Runs a command using subprocess.check_output with timeout and retry logic.
37-
38- Args:
39- command: A list representing the command and its arguments.
40- timeout: The maximum time (in seconds) to wait for each command execution.
41- retries: The number of times to retry the command if it times out.
42-
43- Returns:
44- The output of the command as a bytes object if successful, otherwise
45- raises a CalledProcessError.
46- """
47- for attempt in range (1 , retries + 1 ):
48- try :
49- result = subprocess .check_output (command , timeout = timeout )
50- return result .decode ('utf-8' ).strip ()
51- except subprocess .TimeoutExpired :
52- if attempt >= retries :
53- raise # Re-raise the TimeoutExpired error after all retries
54-
55-
5634def main ():
5735 parser = OptionParser ()
5836 parser .add_option ("--print_sdk_path" ,
@@ -91,7 +69,7 @@ def main():
9169 'if you are using Xcode 4.' ) % job .returncode )
9270
9371 # Locate the host toolchain.
94- xcode_dir = run_command_with_retry (['xcode-select' , '-print-path' ], timeout = 300 )
72+ xcode_dir = subprocess . check_output (['xcode-select' , '-print-path' ], timeout = 300 ). decode ( 'utf-8' ). strip ( )
9573 toolchain_dir = os .path .join (xcode_dir , 'Toolchains/XcodeDefault.xctoolchain' )
9674
9775 # Locate the target SDK.
@@ -101,7 +79,7 @@ def main():
10179 'macosx' ,
10280 '--show-sdk-path' ,
10381 ]
104- sdk_output = run_command_with_retry (sdk_command , timeout = 300 )
82+ sdk_output = subprocess . check_output (sdk_command , timeout = 300 ). decode ( 'utf-8' ). strip ( )
10583 if symlink_path :
10684 sdks_path = os .path .join (symlink_path , 'SDKs' )
10785 # Symlink the host toolchain.
0 commit comments