@@ -951,8 +951,9 @@ def map_easyconfig_to_target_tc_hierarchy(ec_spec, toolchain_mapping, targetdir=
951951 parsed_ec = process_easyconfig (ec_spec , validate = False )[0 ]['ec' ]
952952
953953 versonsuffix_mapping = {}
954-
955- if update_dep_versions :
954+ # We only need to map versionsuffixes if we are updating dependency versions and if there are
955+ # versionsuffixes being used in dependencies
956+ if update_dep_versions and list_deps_versionsuffixes (ec_spec ):
956957 # We may need to update the versionsuffix if it is like, for example, `-Python-2.7.8`
957958 versonsuffix_mapping = map_common_versionsuffixes ('Python' , parsed_ec ['toolchain' ], toolchain_mapping )
958959
@@ -1059,6 +1060,34 @@ def map_easyconfig_to_target_tc_hierarchy(ec_spec, toolchain_mapping, targetdir=
10591060 return tweaked_spec
10601061
10611062
1063+ def list_deps_versionsuffixes (ec_spec ):
1064+ """
1065+ Take an easyconfig spec, parse it, extracts the list of version suffixes used in its dependencies
1066+
1067+ :param ec_spec: location of original easyconfig file
1068+
1069+ :return: The list of versionsuffixes used by the dependencies of this recipe
1070+ """
1071+ # Fully parse the original easyconfig
1072+ parsed_ec = process_easyconfig (ec_spec , validate = False )[0 ]['ec' ]
1073+
1074+ versionsuffix_list = []
1075+ for key in DEPENDENCY_PARAMETERS :
1076+ # loop over a *copy* of dependency dicts (with resolved templates);
1077+
1078+ # to update the original dep dict, we need to get a reference with templating disabled...
1079+ val = parsed_ec [key ]
1080+
1081+ if key in parsed_ec .iterate_options :
1082+ val = flatten (val )
1083+
1084+ for dep in val :
1085+ if dep ['versionsuffix' ]:
1086+ versionsuffix_list += [dep ['versionsuffix' ]]
1087+
1088+ return list (set (versionsuffix_list ))
1089+
1090+
10621091def find_potential_version_mappings (dep , toolchain_mapping , versionsuffix_mapping = None , highest_versions_only = True ):
10631092 """
10641093 Find potential version mapping for a dependency in a new hierarchy
0 commit comments