Conversation
…SON file The supported toplevel toolchains per EESSI version are now defined in eessi_supported_toolchains.json rather than in eb_hooks.py itself, so that they can also be used by other scripts without having to parse (or import) the hooks file. - eessi_supported_toolchains.json is located next to eb_hooks.py, both in the repository and when installed in <prefix>/init/easybuild/ by install_scripts.sh. eb_hooks.py locates it relative to its own location. - Toolchains that can only be installed with a recent enough EasyBuild version (lfoss/2025b, rompi/2025a) now specify 'min_easybuild_version' instead of being appended conditionally in eb_hooks.py. - CI also checks that the deployed eessi_supported_toolchains.json is up-to-date, like is done for eb_hooks.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
trz42
left a comment
There was a problem hiding this comment.
Small and simple change.
Find it a little unsatisfactory for being generated by an AI-assistant:
- duplicated code in the test (and name of test file is a bit off now)
- it could have added some unit tests for the function and JSON format
- would have been nice with some specific instructions on how this was tested (command log)
- PR title is repeated in the PR description
| # Copy over EasyBuild hooks file used for installations | ||
| hook_files=( | ||
| eb_hooks.py | ||
| eessi_supported_toolchains.json |
There was a problem hiding this comment.
Maybe it could be here, but then the name hook_files is a little off. Maybe easybuild_init_files is fitting.
| module load EESSI-extend | ||
| diff "$TEMP_FILE" "$EASYBUILD_HOOKS" | ||
|
|
||
| - name: Check whether eessi_supported_toolchains.json (used by eb_hooks.py) is up-to-date |
There was a problem hiding this comment.
Essentially the same as the check for eb_hooks.py? If so could we use another matrix variable for the files to be checked?
| toolchains = json.load(fh) | ||
| except (OSError, ValueError) as err: | ||
| raise EasyBuildError(f"Failed to load supported toolchains from {toolchains_file} " | ||
| f"(it is expected to be located next to the EasyBuild hooks file): {err}") |
There was a problem hiding this comment.
Maybe the text in parantheses is a little speculative as you also show this for ValueError?
| Load the supported top-level toolchains per EESSI version from eessi_supported_toolchains.json, | ||
| which is located next to this hooks file (both in the software-layer-scripts repository, and when installed | ||
| in <EESSI prefix>/init/easybuild). Toolchains that require a more recent EasyBuild version than the one | ||
| being used (as specified via 'min_easybuild_version') are left out. |
There was a problem hiding this comment.
Maybe add
Returns:
supported_toolchains (dict)
| in <EESSI prefix>/init/easybuild). Toolchains that require a more recent EasyBuild version than the one | ||
| being used (as specified via 'min_easybuild_version') are left out. | ||
| """ | ||
| toolchains_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'eessi_supported_toolchains.json') |
There was a problem hiding this comment.
How about specifying the location via an environment variable? Inferring the location from the location of eb_hooks.py could be a fallback if the environment variable is not set.
Move supported toplevel toolchains from
eb_hooks.pyinto a separate JSON fileThe toplevel toolchains supported per EESSI version (
EESSI_SUPPORTED_TOP_LEVEL_TOOLCHAINS) are defined insideeb_hooks.py. Other scripts that need this list (e.g. the native compiler flags check in #311 ) would have to parse or import the hooks file, and importing it requires EasyBuild. This PR moves the list intoeessi_supported_toolchains.json, so the list stays in one place and any script can read it.eessi_supported_toolchains.jsonsits next toeb_hooks.py, andinstall_scripts.shinstalls it next to it in<prefix>/init/easybuild/.eb_hooks.pylocates it relative to its own file. This works regardless of whether theeb_hooks.pyfile is used from it's installed location in the CVMFS repo, or from a clone of thesoftware-layer-scriptsrepository, since every EasyBuild version in use loads the hooks viaimportlib'sspec_from_file_location, which sets__file__. If the file can't be found or parsed, anEasyBuildErrornames the expected location.lfoss/2025bfrom 5.2.0,rompi/2025afrom 5.3.1) have amin_easybuild_versionfield instead of being appended conditionally in code.test-eb-hooks.ymlalso checks that the deployedeessi_supported_toolchains.jsonmatches the repo, like the existing check foreb_hooks.py.Testing done (by AI). Loaded through EasyBuild's own hooks loader,
EESSI_SUPPORTED_TOP_LEVEL_TOOLCHAINSis identical before and after this change under EasyBuild 4.9.4, 5.2.1 and 5.4.0, which covers both version guards. Witheb --stop fetchin EESSI 2025.06 (EasyBuild 5.4.0), the toolchain check still acceptsM4-1.4.19-GCCcore-14.2.0andCDO-2.5.3-lompi-2025b, and rejectsM4-1.4.19-GCCcore-12.3.0. That holds both for the repo'seb_hooks.pyand for a copy installed withinstall_scripts.shinto a scratch prefix.Note: anyone pointing
EASYBUILD_HOOKSat their own copy ofeb_hooks.pynow needseessi_supported_toolchains.jsonnext to it.Deploy required
Note that since this PR changes
eb_hooks.py, it needs to be deployed (only once per EESSI version, I believe, since it's installed into<EESSI_VERSION>/init/easybuild).AI disclosure
This change was made with an AI coding assistant (Claude, via Claude Code), as a spin-off of the native compiler flags check PR (#311). I asked for the supported-toolchains list to be moved out of
eb_hooks.pyinto an easily parseable file used by botheb_hooks.pyand the new check, with the requirement that it works both from a clone of this repository and from the copy installed in CVMFS.The assistant:
At my request it then split this off from the larger PR into this preparatory one. I reviewed the result before opening this PR.
🤖 Generated with Claude Code