@@ -98,21 +98,26 @@ if (eessi_accelerator_target ~= nil) then
9898 end
9999end
100100
101+ -- Some environment variables affect behaviour, let's gather them once
102+ local eessi_cvmfs_install = os.getenv("EESSI_CVMFS_INSTALL") ~= nil
103+ local eessi_site_install = os.getenv("EESSI_SITE_INSTALL") ~= nil
104+ local eessi_project_install = os.getenv("EESSI_PROJECT_INSTALL") ~= nil
105+ local eessi_user_install = os.getenv("EESSI_USER_INSTALL") ~= nil
106+
101107-- Use an installation prefix that we _should_ have write access to
102- if (os.getenv("EESSI_CVMFS_INSTALL") ~= nil) then
108+ if eessi_cvmfs_install then
103109 -- Make sure no other EESSI install environment variables are set
104- if ((os.getenv("EESSI_SITE_INSTALL") ~= nil) or (os.getenv("EESSI_PROJECT_INSTALL") ~= nil) or (os.getenv("EESSI_USER_INSTALL") ~= nil) ) then
110+ if (eessi_site_install or eessi_project_install or eessi_user_install ) then
105111 LmodError("You cannot use EESSI_CVMFS_INSTALL in combination with any other EESSI_*_INSTALL environment variables")
106112 end
107- eessi_cvmfs_install = true
108113 easybuild_installpath = os.getenv("EESSI_SOFTWARE_PATH")
109114 -- enforce accelerator subdirectory usage for CVMFS installs (only if an accelerator install is requested)
110115 if (eessi_accelerator_target ~= nil) and (cuda_compute_capability ~= nil) and (os.getenv("EESSI_ACCELERATOR_INSTALL") ~= nil) then
111116 easybuild_installpath = pathJoin(easybuild_installpath, eessi_accelerator_target)
112117 end
113- elseif (os.getenv("EESSI_SITE_INSTALL") ~= nil) then
118+ elseif eessi_site_install then
114119 -- Make sure no other EESSI install environment variables are set
115- if ((os.getenv("EESSI_PROJECT_INSTALL") ~= nil) or (os.getenv("EESSI_USER_INSTALL") ~= nil) ) then
120+ if (eessi_project_install or eessi_user_install ) then
116121 LmodError("You cannot use EESSI_SITE_INSTALL in combination with any other EESSI_*_INSTALL environment variables")
117122 end
118123 easybuild_installpath = os.getenv("EESSI_SITE_SOFTWARE_PATH")
@@ -122,35 +127,35 @@ elseif (os.getenv("EESSI_SITE_INSTALL") ~= nil) then
122127 end
123128else
124129 -- Deal with user and project installs
125- project_install = os.getenv("EESSI_PROJECT_INSTALL")
130+ project_install_dir = os.getenv("EESSI_PROJECT_INSTALL")
126131 project_modulepath = nil
127- if (project_install ~= nil) then
132+ if eessi_project_install then
128133 -- Check the folder exists
129- if not isDir(project_install ) then
130- LmodError("The location of EESSI_PROJECT_INSTALL (" .. project_install .. ") does not exist or is not a folder")
134+ if not isDir(project_install_dir ) then
135+ LmodError("The location of EESSI_PROJECT_INSTALL (" .. project_install_dir .. ") does not exist or is not a folder")
131136 end
132137 if (mode() == "load") then
133- LmodMessage("Configuring for use of EESSI_PROJECT_INSTALL under " .. project_install )
138+ LmodMessage("Configuring for use of EESSI_PROJECT_INSTALL under " .. project_install_dir )
134139 end
135- easybuild_installpath = string.gsub(os.getenv("EESSI_SOFTWARE_PATH"), os.getenv("EESSI_CVMFS_REPO"), project_install )
140+ easybuild_installpath = string.gsub(os.getenv("EESSI_SOFTWARE_PATH"), os.getenv("EESSI_CVMFS_REPO"), project_install_dir )
136141 project_modulepath = pathJoin(easybuild_installpath, 'modules', 'all')
137142 end
138- user_install = os.getenv("EESSI_USER_INSTALL")
143+ user_install_dir = os.getenv("EESSI_USER_INSTALL")
139144 user_modulepath = nil
140- if (user_install ~= nil) then
145+ if eessi_user_install then
141146 -- Check the folder exists
142- if not isDir(user_install ) then
143- LmodError("The location of EESSI_USER_INSTALL (" .. user_install .. ") does not exist or is not a folder")
147+ if not isDir(user_install_dir ) then
148+ LmodError("The location of EESSI_USER_INSTALL (" .. user_install_dir .. ") does not exist or is not a folder")
144149 end
145- elseif (user_install == nil) and (project_install == nil) then
150+ elseif (user_install_dir == nil) and (project_install_dir == nil) then
146151 -- No need to check for existence when we use a HOME subdir
147- user_install = pathJoin(os.getenv("HOME"), "eessi")
152+ user_install_dir = pathJoin(os.getenv("HOME"), "eessi")
148153 end
149- if (user_install ~= nil) then
154+ if (user_install_dir ~= nil) then
150155 if (mode() == "load") then
151- LmodMessage("Configuring for use of EESSI_USER_INSTALL under " .. user_install )
156+ LmodMessage("Configuring for use of EESSI_USER_INSTALL under " .. user_install_dir )
152157 end
153- easybuild_installpath = string.gsub(os.getenv("EESSI_SOFTWARE_PATH"), os.getenv("EESSI_CVMFS_REPO"), user_install )
158+ easybuild_installpath = string.gsub(os.getenv("EESSI_SOFTWARE_PATH"), os.getenv("EESSI_CVMFS_REPO"), user_install_dir )
154159 user_modulepath = pathJoin(easybuild_installpath, 'modules', 'all')
155160 end
156161end
@@ -196,10 +201,29 @@ elseif (project_modulepath ~= nil) then
196201 -- configure MODULEPATH
197202 prepend_path("MODULEPATH", project_modulepath)
198203end
204+
199205-- Make sure EasyBuild itself is loaded
206+ -- need to also handle the unload behaviour where the version is defined only before we unload
207+ easybuild_version = os.getenv("EBVERSIONEASYBUILD")
200208if not ( isloaded("EasyBuild") ) then
201209 load(latest("EasyBuild"))
202210end
211+ easybuild_version = os.getenv("EBVERSIONEASYBUILD") or easybuild_version
212+ eessi_version = os.getenv("EESSI_VERSION") or "2023.06"
213+
214+ -- Set environment variables that are EasyBuild version specific
215+ if convertToCanonical(easybuild_version) > convertToCanonical("4") then
216+ setenv ("EASYBUILD_STRICT_RPATH_SANITY_CHECK", "1")
217+ setenv ("EASYBUILD_CUDA_SANITY_CHECK_ERROR_ON_FAILED_CHECKS", "1")
218+ setenv ("EASYBUILD_FAIL_ON_MOD_FILES_GCCCORE", "1")
219+ setenv ("EASYBUILD_LOCAL_VAR_NAMING_CHECK", "error")
220+ -- Set environment variables that are EESSI version specific
221+ if convertToCanonical(eessi_version) > convertToCanonical("2023.06") then
222+ setenv ("EASYBUILD_PREFER_PYTHON_SEARCH_PATH", "EBPYTHONPREFIXES")
223+ setenv ("EASYBUILD_MODULE_SEARCH_PATH_HEADERS", "include_paths")
224+ setenv ("EASYBUILD_SEARCH_PATH_CPP_HEADERS", "include_paths")
225+ end
226+ end
203227"""
204228
205229moduleclass = 'devel'
0 commit comments