@@ -909,8 +909,11 @@ def map_common_versionsuffixes(software_name, original_toolchain, toolchain_mapp
909909 if original_suffix in versionsuffix_mappings :
910910 if mapped_suffix != versionsuffix_mappings [original_suffix ]:
911911 raise EasyBuildError ("No unique versionsuffix mapping for %s in %s toolchain "
912- "hierarchy to %s toolchain hierarchy" , original_suffix ,
913- original_toolchain , toolchain_mapping [original_toolchain ['name' ]])
912+ "hierarchy to %s toolchain hierarchy (mapped suffix was %s but "
913+ "versionsuffix mappings were %s)" ,
914+ original_suffix , original_toolchain ,
915+ toolchain_mapping [original_toolchain ['name' ]], mapped_suffix ,
916+ versionsuffix_mappings )
914917 else :
915918 versionsuffix_mappings [original_suffix ] = mapped_suffix
916919
@@ -953,8 +956,9 @@ def map_easyconfig_to_target_tc_hierarchy(ec_spec, toolchain_mapping, targetdir=
953956 parsed_ec = process_easyconfig (ec_spec , validate = False )[0 ]['ec' ]
954957
955958 versonsuffix_mapping = {}
956-
957- if update_dep_versions :
959+ # We only need to map versionsuffixes if we are updating dependency versions and if there are
960+ # versionsuffixes being used in dependencies
961+ if update_dep_versions and list_deps_versionsuffixes (ec_spec ):
958962 # We may need to update the versionsuffix if it is like, for example, `-Python-2.7.8`
959963 versonsuffix_mapping = map_common_versionsuffixes ('Python' , parsed_ec ['toolchain' ], toolchain_mapping )
960964
@@ -1061,6 +1065,31 @@ def map_easyconfig_to_target_tc_hierarchy(ec_spec, toolchain_mapping, targetdir=
10611065 return tweaked_spec
10621066
10631067
1068+ def list_deps_versionsuffixes (ec_spec ):
1069+ """
1070+ Take an easyconfig spec, parse it, extracts the list of version suffixes used in its dependencies
1071+
1072+ :param ec_spec: location of original easyconfig file
1073+
1074+ :return: The list of versionsuffixes used by the dependencies of this recipe
1075+ """
1076+ # Fully parse the original easyconfig
1077+ parsed_ec = process_easyconfig (ec_spec , validate = False )[0 ]['ec' ]
1078+
1079+ versionsuffix_list = []
1080+ for key in DEPENDENCY_PARAMETERS :
1081+ val = parsed_ec [key ]
1082+
1083+ if key in parsed_ec .iterate_options :
1084+ val = flatten (val )
1085+
1086+ for dep in val :
1087+ if dep ['versionsuffix' ]:
1088+ versionsuffix_list += [dep ['versionsuffix' ]]
1089+
1090+ return list (set (versionsuffix_list ))
1091+
1092+
10641093def find_potential_version_mappings (dep , toolchain_mapping , versionsuffix_mapping = None , highest_versions_only = True ):
10651094 """
10661095 Find potential version mapping for a dependency in a new hierarchy
0 commit comments