@@ -55,14 +55,28 @@ def append_line_to_file(path, line):
55
55
with open (path , "a" ) as file :
56
56
file .write ("\n " + line + "\n " )
57
57
58
+
58
59
def install_x86_support_libraries ():
59
60
"""Install support libraries needed to build x86 on x86_64 hosts."""
60
61
if utils .is_linux_os ():
61
- utils .run_command (['apt' , 'install' , 'gcc-multilib' , 'g++-multilib' ], as_root = True )
62
- utils .run_command (['dpkg' , '--add-architecture' , 'i386' ], as_root = True )
63
- utils .run_command (['apt' , 'update' ], as_root = True )
64
- utils .run_command (['apt' , 'install' , 'libglib2.0-dev:i386' ], as_root = True )
65
- utils .run_command (['apt' , 'install' , 'libsecret-1-dev:i386' ], as_root = True )
62
+ packages = ('libglib2.0-dev:i386' , 'libsecret-1-dev:i386' )
63
+
64
+ # First check if these packages exist on the machine already
65
+ import apt
66
+ cache = apt .Cache ()
67
+ package_installed = []
68
+ for package in packages :
69
+ if package in cache .keys ():
70
+ package_installed .append (cache [package ].is_installed )
71
+ else :
72
+ package_installed .append (False )
73
+
74
+ if not all (package_installed ):
75
+ utils .run_command (['apt' , 'install' , 'gcc-multilib' , 'g++-multilib' ], as_root = True )
76
+ utils .run_command (['dpkg' , '--add-architecture' , 'i386' ], as_root = True )
77
+ utils .run_command (['apt' , 'update' ], as_root = True )
78
+ for package in packages :
79
+ utils .run_command (['apt' , 'install' , package ], as_root = True )
66
80
67
81
68
82
def _install_cpp_dependencies_with_vcpkg (arch , msvc_runtime_library ):
0 commit comments