@@ -382,31 +382,16 @@ def get_variable(self, name, typ=str):
382382 return res
383383
384384 def set_variables (self ):
385- """Set generic toolchain variables. Child toolchains oversubscribe this method."""
385+ """
386+ No generic toolchain variables set.
387+ Post-process variables set by child Toolchain classes.
388+ """
386389
387390 if self .options .option ('packed-linker-options' ):
388391 self .log .devel ("set_variables: toolchain variables. packed-linker-options." )
389392 self .variables .try_function_on_element ('set_packed_linker_options' )
390393 self .log .devel ("set_variables: toolchain variables. Do nothing." )
391394
392- # mode of operation for search paths
393- # toolchain option has precedence over build option
394- for search_path in self .search_path :
395- sp_build_opt = f"search_path_{ search_path } "
396- sp_toolchain_opt = sp_build_opt .replace ("_" , "-" )
397- if self .options .get (sp_toolchain_opt ) is not None :
398- self .search_path [search_path ] = self .options .option (sp_toolchain_opt )
399- elif build_option (sp_build_opt ) is not None :
400- self .search_path [search_path ] = build_option (sp_build_opt )
401-
402- if self .search_path [search_path ] not in SEARCH_PATH [search_path ]:
403- raise EasyBuildError (
404- "Unknown value selected for toolchain option %s: %s. Choose one of: %s" ,
405- sp_toolchain_opt , self .search_path [search_path ], ", " .join (SEARCH_PATH [search_path ])
406- )
407-
408- self .log .debug ("%s toolchain option set to: %s" , sp_toolchain_opt , self .search_path [search_path ])
409-
410395 def generate_vars (self ):
411396 """Convert the variables in simple vars"""
412397 self .vars = {}
@@ -786,6 +771,27 @@ def _verify_toolchain(self):
786771 raise EasyBuildError ("List of toolchain dependency modules and toolchain definition do not match "
787772 "(found %s vs expected %s)" , self .toolchain_dep_mods , toolchain_definition )
788773
774+ def _validate_search_path (self ):
775+ """
776+ Validate search path toolchain options.
777+ Toolchain option has precedence over build option
778+ """
779+ for search_path in self .search_path :
780+ sp_build_opt = f"search_path_{ search_path } "
781+ sp_toolchain_opt = sp_build_opt .replace ("_" , "-" )
782+ if self .options .get (sp_toolchain_opt ) is not None :
783+ self .search_path [search_path ] = self .options .option (sp_toolchain_opt )
784+ elif build_option (sp_build_opt ) is not None :
785+ self .search_path [search_path ] = build_option (sp_build_opt )
786+
787+ if self .search_path [search_path ] not in SEARCH_PATH [search_path ]:
788+ raise EasyBuildError (
789+ "Unknown value selected for toolchain option %s: %s. Choose one of: %s" ,
790+ sp_toolchain_opt , self .search_path [search_path ], ", " .join (SEARCH_PATH [search_path ])
791+ )
792+
793+ self .log .debug ("%s toolchain option set to: %s" , sp_toolchain_opt , self .search_path [search_path ])
794+
789795 def symlink_commands (self , paths ):
790796 """
791797 Create a symlink for each command to binary/script at specified path.
@@ -865,7 +871,6 @@ def prepare(self, onlymod=None, deps=None, silent=False, loadmod=True,
865871 self ._load_modules (silent = silent )
866872
867873 if self .is_system_toolchain ():
868-
869874 # define minimal build environment when using system toolchain;
870875 # this is mostly done to try controlling which compiler commands are being used,
871876 # cfr. https://github.com/easybuilders/easybuild-framework/issues/3398
@@ -878,6 +883,7 @@ def prepare(self, onlymod=None, deps=None, silent=False, loadmod=True,
878883 self ._verify_toolchain ()
879884
880885 # Generate the variables to be set
886+ self ._validate_search_path ()
881887 self .set_variables ()
882888
883889 # set the variables
0 commit comments