From 0c7f1ab6a4fcaa87195b6e1e15e1fe629ea80f0a Mon Sep 17 00:00:00 2001 From: Damian Alvarez <alvarezmallon1@jwlogin09.juwels> Date: Fri, 12 Nov 2021 16:34:57 +0100 Subject: [PATCH] To allow broader dependency replacement (not just versions, but complete dependencies) --- Custom_Hooks/eb_hooks.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/Custom_Hooks/eb_hooks.py b/Custom_Hooks/eb_hooks.py index d1ff1912b..49dcee775 100644 --- a/Custom_Hooks/eb_hooks.py +++ b/Custom_Hooks/eb_hooks.py @@ -62,6 +62,10 @@ VETOED_INSTALLATIONS = { TWEAKABLE_DEPENDENCIES = { 'UCX': 'default', 'CUDA': '11.5', + 'Mesa': ('OpenGL', '2021b'), + 'libglvnd': ('OpenGL', '2021b'), + 'glu': ('OpenGL', '2021b'), + 'glew': ('OpenGL', '2021b'), } common_site_contact = 'Support <sc@fz-juelich.de>' @@ -251,11 +255,25 @@ def tweak_dependencies(ec): # being overwritten for dep_to_tweak in TWEAKABLE_DEPENDENCIES: for dep in dependencies: + remove = False if dep_to_tweak in dep[0]: list_dep = list(dep) - list_dep[1] = TWEAKABLE_DEPENDENCIES[dep_to_tweak] - dependencies[dependencies.index(dep)] = tuple(list_dep) - ec[dep_type] = dependencies + if isinstance(TWEAKABLE_DEPENDENCIES[dep_to_tweak], str): + list_dep[1] = TWEAKABLE_DEPENDENCIES[dep_to_tweak] + else: + # Assume that the name of the dependency also needs to be replaced, using the specified tuple + if TWEAKABLE_DEPENDENCIES[dep_to_tweak][0] not in [x[0] for x in dependencies]: + # The new dependency is not on the list, so add it + list_dep[0] = TWEAKABLE_DEPENDENCIES[dep_to_tweak][0] + list_dep[1] = TWEAKABLE_DEPENDENCIES[dep_to_tweak][1] + else: + # Remove it from the list to don't have the same dependency added N times + remove = True + if remove: + del dependencies[dependencies.index(dep)] + else: + dependencies[dependencies.index(dep)] = tuple(list_dep) + ec[dep_type] = dependencies return ec -- GitLab