@@ -415,11 +415,11 @@ def set_alias(self, key, value):
415415 """
416416 raise NotImplementedError
417417
418- def set_as_default (self , module_folder_path , module_version , mod_symlink_paths = None ):
418+ def set_as_default (self , module_dir_path , module_version , mod_symlink_paths = None ):
419419 """
420420 Set generated module as default module
421421
422- :param module_folder_path : module folder path, e.g. $HOME/easybuild/modules/all/Bison
422+ :param module_dir_path : module directory path, e.g. $HOME/easybuild/modules/all/Bison
423423 :param module_version: module version, e.g. 3.0.4
424424 :param mod_symlink_paths: list of paths in which symlinks to module files must be created
425425 """
@@ -873,35 +873,35 @@ def set_alias(self, key, value):
873873 # quotes are needed, to ensure smooth working of EBDEVEL* modulefiles
874874 return 'set-alias\t %s\t \t %s\n ' % (key , quote_str (value , tcl = True ))
875875
876- def set_as_default (self , module_folder_path , module_version , mod_symlink_paths = None ):
876+ def set_as_default (self , module_dir_path , module_version , mod_symlink_paths = None ):
877877 """
878878 Create a .version file inside the package module folder in order to set the default version for TMod
879879
880- :param module_folder_path : module folder path, e.g. $HOME/easybuild/modules/all/Bison
880+ :param module_dir_path : module directory path, e.g. $HOME/easybuild/modules/all/Bison
881881 :param module_version: module version, e.g. 3.0.4
882882 :param mod_symlink_paths: list of paths in which symlinks to module files must be created
883883 """
884884 txt = self .MODULE_SHEBANG + '\n '
885885 txt += 'set ModulesVersion %s\n ' % module_version
886886
887887 # write the file no matter what
888- dot_version_path = os .path .join (module_folder_path , '.version' )
888+ dot_version_path = os .path .join (module_dir_path , '.version' )
889889 write_file (dot_version_path , txt )
890890
891891 # create symlink to .version file in class module folders
892892 if mod_symlink_paths is None :
893893 mod_symlink_paths = []
894894
895+ module_dir_name = os .path .basename (module_dir_path )
895896 for mod_symlink_path in mod_symlink_paths :
896- module_name = os .path .basename (module_folder_path )
897- class_module_folder = os .path .join (install_path ('mod' ), mod_symlink_path , module_name )
898- dot_version_link_path = os .path .join (class_module_folder , '.version' )
897+ mod_symlink_dir = os .path .join (install_path ('mod' ), mod_symlink_path , module_dir_name )
898+ dot_version_link_path = os .path .join (mod_symlink_dir , '.version' )
899899 if os .path .islink (dot_version_link_path ):
900900 link_target = resolve_path (dot_version_link_path )
901901 remove_file (dot_version_link_path )
902902 self .log .info ("Removed default version marking from %s." , link_target )
903903 elif os .path .exists (dot_version_link_path ):
904- raise EasyBuildError ('Found an unexpected file named .version in dir %s' % class_module_folder )
904+ raise EasyBuildError ('Found an unexpected file named .version in dir %s' , mod_symlink_dir )
905905 symlink (dot_version_path , dot_version_link_path , use_abspath_source = True )
906906
907907 def set_environment (self , key , value , relpath = False ):
@@ -1296,37 +1296,38 @@ def set_alias(self, key, value):
12961296 # quotes are needed, to ensure smooth working of EBDEVEL* modulefiles
12971297 return 'set_alias("%s", %s)\n ' % (key , quote_str (value ))
12981298
1299- def set_as_default (self , module_folder_path , module_version , mod_symlink_paths = None ):
1299+ def set_as_default (self , module_dir_path , module_version , mod_symlink_paths = None ):
13001300 """
13011301 Create a symlink named 'default' inside the package's module folder in order to set the default module version
13021302
1303- :param module_folder_path : module folder path, e.g. $HOME/easybuild/modules/all/Bison
1303+ :param module_dir_path : module directory path, e.g. $HOME/easybuild/modules/all/Bison
13041304 :param module_version: module version, e.g. 3.0.4
13051305 :param mod_symlink_paths: list of paths in which symlinks to module files must be created
13061306 """
1307- def create_default_symlink (module_folder_path ):
1308- default_filepath = os .path .join (module_folder_path , 'default' )
1307+ def create_default_symlink (path ):
1308+ """Helper function to create 'default' symlink in specified directory."""
1309+ default_filepath = os .path .join (path , 'default' )
13091310
13101311 if os .path .islink (default_filepath ):
13111312 link_target = resolve_path (default_filepath )
13121313 remove_file (default_filepath )
13131314 self .log .info ("Removed default version marking from %s." , link_target )
13141315 elif os .path .exists (default_filepath ):
1315- raise EasyBuildError ('Found an unexpected file named default in dir %s' % module_folder_path )
1316+ raise EasyBuildError ('Found an unexpected file named default in dir %s' , module_dir_path )
13161317
13171318 symlink (module_version + self .MODULE_FILE_EXTENSION , default_filepath , use_abspath_source = False )
13181319 self .log .info ("Module default version file written to point to %s" , default_filepath )
13191320
1320- create_default_symlink (module_folder_path )
1321+ create_default_symlink (module_dir_path )
13211322
13221323 # also create symlinks in class module folders
13231324 if mod_symlink_paths is None :
13241325 mod_symlink_paths = []
13251326
13261327 for mod_symlink_path in mod_symlink_paths :
1327- module_name = os .path .basename (module_folder_path )
1328- module_folder_path = os .path .join (install_path ('mod' ), mod_symlink_path , module_name )
1329- create_default_symlink (module_folder_path )
1328+ mod_dir_name = os .path .basename (module_dir_path )
1329+ mod_symlink_dir = os .path .join (install_path ('mod' ), mod_symlink_path , mod_dir_name )
1330+ create_default_symlink (mod_symlink_dir )
13301331
13311332 def set_environment (self , key , value , relpath = False ):
13321333 """
0 commit comments