@@ -428,51 +428,66 @@ def install_or_upgrade_vc_redist(self) -> None:
428
428
"""
429
429
Install the latest visual studio redistributable files
430
430
"""
431
+ import ibex_install_utils .default_args
431
432
432
- is_64_bit = platform .machine ().endswith ("64" )
433
- exe_file = Path (EPICS_CRTL_PATH , f"vc_redist.{ 'x64' if is_64_bit else 'x86' } .exe" )
434
- if exe_file .exists () and exe_file .is_file ():
435
- log_file = Path (
436
- VAR_DIR , "logs" , "deploy" , f"vc_redist_log{ time .strftime ('%Y%m%d%H%M%S' )} .txt"
437
- )
433
+ arch = ibex_install_utils .default_args .SERVER_ARCH
438
434
439
- # AdminRunner doesn't seem to work here, saying it can't find a handle, so just run as a
440
- # normal command as the process itself prompts for admin.
441
- RunProcess (
442
- working_dir = str (exe_file .parent ),
443
- executable_file = exe_file .name ,
444
- prog_args = ["/install" , "/norestart" , "/passive" , "/quiet" , "/log" , str (log_file )],
445
- expected_return_codes = [0 ],
446
- ).run ()
447
-
448
- # vc_redist helpfully finishes with errorlevel 0 before actually copying the files over.
449
- # therefore we'll sleep for 5 seconds here
450
- print ("waiting for install to finish" )
451
- sleep (5 )
452
-
453
- last_line = ""
454
- with open (log_file , "r" ) as f :
455
- for line in f .readlines ():
456
- print ("vc_redist install output: {}" .format (line .rstrip ()))
457
- last_line = line
458
-
459
- status = (
460
- "It looked like it installed correctly, but "
461
- if "Exit code: 0x0" in last_line
462
- else "it looked like the process errored,"
463
- )
435
+ print (f"Installing vc_redist for arch: { arch } " )
464
436
465
- self .prompt .prompt_and_raise_if_not_yes (
466
- f"Installing vc redistributable files finished.\n "
467
- f"{ status } "
468
- f"please check log output above for errors,\n or alternatively { log_file } " ,
469
- default = "Y" ,
470
- )
471
- else :
472
- raise ErrorInTask (
473
- f"VC redistributable files not found in { exe_file .parent } , please check"
474
- f" and make sure { exe_file } is present. "
475
- )
437
+ files_to_run = [f"vc_redist.x64.exe" ]
438
+ if arch == "x86" :
439
+ files_to_run .insert (0 , "vc_redist.x86.exe" )
440
+ for file in files_to_run :
441
+ exe_file = Path (EPICS_CRTL_PATH , file )
442
+ if exe_file .exists () and exe_file .is_file ():
443
+ log_file = Path (
444
+ VAR_DIR , "logs" , "deploy" , f"vc_redist_log{ time .strftime ('%Y%m%d%H%M%S' )} .txt"
445
+ )
446
+
447
+ # AdminRunner doesn't seem to work here, saying it can't find a handle, so just run as a
448
+ # normal command as the process itself prompts for admin.
449
+ RunProcess (
450
+ working_dir = str (exe_file .parent ),
451
+ executable_file = exe_file .name ,
452
+ prog_args = [
453
+ "/install" ,
454
+ "/norestart" ,
455
+ "/passive" ,
456
+ "/quiet" ,
457
+ "/log" ,
458
+ str (log_file ),
459
+ ],
460
+ expected_return_codes = [0 ],
461
+ ).run ()
462
+
463
+ # vc_redist helpfully finishes with errorlevel 0 before actually copying the files over.
464
+ # therefore we'll sleep for 5 seconds here
465
+ print ("waiting for install to finish" )
466
+ sleep (5 )
467
+
468
+ last_line = ""
469
+ with open (log_file , "r" ) as f :
470
+ for line in f .readlines ():
471
+ print ("vc_redist install output: {}" .format (line .rstrip ()))
472
+ last_line = line
473
+
474
+ status = (
475
+ "It looked like it installed correctly, but "
476
+ if "Exit code: 0x0" in last_line
477
+ else "it looked like the process errored,"
478
+ )
479
+
480
+ self .prompt .prompt_and_raise_if_not_yes (
481
+ f"Installing vc redistributable files finished.\n "
482
+ f"{ status } "
483
+ f"please check log output above for errors,\n or alternatively { log_file } " ,
484
+ default = "Y" ,
485
+ )
486
+ else :
487
+ raise ErrorInTask (
488
+ f"VC redistributable files not found in { exe_file .parent } , please check"
489
+ f" and make sure { exe_file } is present. "
490
+ )
476
491
477
492
def confirm (self , message : str ) -> None :
478
493
"""
0 commit comments