@@ -323,7 +323,7 @@ def _set_optimal_architecture(self, default_optarch=None):
323323 optarch = build_option ('optarch' )
324324
325325 # --optarch is specified with flags to use
326- if optarch is not None and isinstance (optarch , dict ):
326+ if isinstance (optarch , dict ):
327327 # optarch has been validated as complex string with multiple compilers and converted to a dictionary
328328 # first try module names, then the family in optarch
329329 current_compiler_names = (getattr (self , 'COMPILER_MODULE_NAME' , []) +
@@ -338,14 +338,12 @@ def _set_optimal_architecture(self, default_optarch=None):
338338 self .log .info ("_set_optimal_architecture: no optarch found for compiler %s. Ignoring option." ,
339339 current_compiler )
340340
341- use_generic = False
342- if optarch is not None :
343- # optarch has been parsed as a simple string
344- if isinstance (optarch , string_type ):
345- if optarch == OPTARCH_GENERIC :
346- use_generic = True
347- else :
348- raise EasyBuildError ("optarch is neither an string or a dict %s. This should never happen" , optarch )
341+ if isinstance (optarch , string_type ):
342+ use_generic = (optarch == OPTARCH_GENERIC )
343+ elif optarch is None :
344+ use_generic = False
345+ else :
346+ raise EasyBuildError ("optarch is neither an string or a dict %s. This should never happen" , optarch )
349347
350348 if use_generic :
351349 if (self .arch , self .cpu_family ) in (self .COMPILER_GENERIC_OPTION or []):
@@ -360,10 +358,11 @@ def _set_optimal_architecture(self, default_optarch=None):
360358 optarch = self .COMPILER_OPTIMAL_ARCHITECTURE_OPTION [(self .arch , self .cpu_family )]
361359
362360 if optarch is not None :
363- self .log .info ("_set_optimal_architecture: using %s as optarch for %s." , optarch , self .arch )
361+ optarch_log_str = optarch or 'no flags'
362+ self .log .info ("_set_optimal_architecture: using %s as optarch for %s/%s." ,
363+ optarch_log_str , self .arch , self .cpu_family )
364364 self .options .options_map ['optarch' ] = optarch
365-
366- if self .options .options_map .get ('optarch' , None ) is None :
365+ elif self .options .options_map .get ('optarch' , None ) is None :
367366 optarch_flags_str = "%soptarch flags" % ('' , 'generic ' )[use_generic ]
368367 error_msg = "Don't know how to set %s for %s/%s! " % (optarch_flags_str , self .arch , self .cpu_family )
369368 error_msg += "Use --optarch='<flags>' to override (see "
0 commit comments