diff --git a/Custom_Hooks/eb_hooks.py b/Custom_Hooks/eb_hooks.py index d1ff1912bfcf57843670d17eb22a9cf234e2bbbe..49dcee7756ff3e6b9ebacf8fb34c48cabd29ab48 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