@@ -240,7 +240,7 @@ def setup_waterfall():
240240 subprocess .check_call ([CLANG , '-v' ])
241241 has_vanilla_llvm = True
242242 print '...success'
243- except Exception , e :
243+ except ( OSError , subprocess . CalledProcessError ) as e :
244244 warn ('could not run vanilla LLVM from waterfall: ' + str (e ) +
245245 ', looked for clang at ' + CLANG )
246246
@@ -256,25 +256,31 @@ def setup_waterfall():
256256# external tools
257257
258258try :
259- subprocess .check_call (
260- [NODEJS , '--version' ], stdout = subprocess .PIPE , stderr = subprocess .PIPE )
261- except :
259+ if NODEJS is not None :
260+ subprocess .check_call (
261+ [NODEJS , '--version' ], stdout = subprocess .PIPE , stderr = subprocess .PIPE )
262+ except (OSError , subprocess .CalledProcessError ):
262263 NODEJS = None
264+ if NODEJS is None :
263265 warn ('no node found (did not check proper js form)' )
264266
265267try :
266- subprocess .check_call (
267- [MOZJS , '--version' ], stdout = subprocess .PIPE , stderr = subprocess .PIPE )
268- except :
268+ if MOZJS is not None :
269+ subprocess .check_call (
270+ [MOZJS , '--version' ], stdout = subprocess .PIPE , stderr = subprocess .PIPE )
271+ except (OSError , subprocess .CalledProcessError ):
269272 MOZJS = None
273+ if MOZJS is None :
270274 warn ('no mozjs found (did not check native wasm support nor asm.js'
271275 ' validation)' )
272276
273277try :
274- subprocess .check_call (
275- [EMCC , '--version' ], stdout = subprocess .PIPE , stderr = subprocess .PIPE )
276- except :
278+ if EMCC is not None :
279+ subprocess .check_call (
280+ [EMCC , '--version' ], stdout = subprocess .PIPE , stderr = subprocess .PIPE )
281+ except (OSError , subprocess .CalledProcessError ):
277282 EMCC = None
283+ if EMCC is None :
278284 warn ('no emcc found (did not check non-vanilla emscripten/binaryen'
279285 ' integration)' )
280286
@@ -284,7 +290,7 @@ def setup_waterfall():
284290 [os .path .join (options .binaryen_test , 'emscripten' , 'emcc' ), '--version' ],
285291 stdout = subprocess .PIPE , stderr = subprocess .PIPE )
286292 has_vanilla_emcc = True
287- except :
293+ except ( OSError , subprocess . CalledProcessError ) :
288294 pass
289295
290296
@@ -294,13 +300,13 @@ def setup_waterfall():
294300def delete_from_orbit (filename ):
295301 try :
296302 os .unlink (filename )
297- except :
303+ except OSError :
298304 pass
299305 if not os .path .exists (filename ):
300306 return
301307 try :
302308 shutil .rmtree (filename , ignore_errors = True )
303- except :
309+ except OSError :
304310 pass
305311 if not os .path .exists (filename ):
306312 return
@@ -315,7 +321,7 @@ def remove_readonly_and_try_again(func, path, exc_info):
315321 else :
316322 raise
317323 shutil .rmtree (filename , onerror = remove_readonly_and_try_again )
318- except :
324+ except OSError :
319325 pass
320326
321327
0 commit comments