Skip to content

Commit 85303a3

Browse files
committed
filtering out bad matches due to the absence of a label for system toolchains
1 parent 0409300 commit 85303a3

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

easybuild/framework/easyconfig/tweak.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
from easybuild.tools.config import build_option
5858
from easybuild.tools.filetools import read_file, write_file
5959
from easybuild.tools.module_naming_scheme.utilities import det_full_ec_version
60+
from easybuild.tools.py2vs3 import string_type
6061
from easybuild.tools.robot import resolve_dependencies, robot_find_easyconfig, search_easyconfigs
6162
from easybuild.tools.toolchain.toolchain import SYSTEM_TOOLCHAIN_NAME
6263
from easybuild.tools.toolchain.toolchain import TOOLCHAIN_CAPABILITIES
@@ -1108,14 +1109,12 @@ def find_potential_version_mappings(dep, toolchain_mapping, versionsuffix_mappin
11081109
if len(version_components) > 1: # Have at least major.minor
11091110
candidate_ver_list.append(r'%s\..*' % major_version)
11101111
candidate_ver_list.append(r'.*') # Include a major version search
1111-
11121112
potential_version_mappings, highest_version = [], None
11131113

11141114
for candidate_ver in candidate_ver_list:
11151115

11161116
# if any potential version mappings were found already at this point, we don't add more
11171117
if not potential_version_mappings:
1118-
11191118
for toolchain in toolchain_hierarchy:
11201119

11211120
# determine search pattern based on toolchain, version prefix/suffix & version regex
@@ -1132,6 +1131,21 @@ def find_potential_version_mappings(dep, toolchain_mapping, versionsuffix_mappin
11321131
tweaked_ecs_paths, _ = alt_easyconfig_paths(tempfile.gettempdir(), tweaked_ecs=True)
11331132
cand_paths = [path for path in cand_paths if not path.startswith(tweaked_ecs_paths)]
11341133

1134+
# if SYSTEM_TOOLCHAIN_NAME is used, it produces regex of the form
1135+
# <name>-<version_regex>.eb, which can map to incompatible toolchains.
1136+
# For example Boost-1.68\..*.eb would match Boost-1.68.0-intel-2019a.eb
1137+
# This filters out such matches unless the toolchain in the easyconfig matches a system toolchain
1138+
if toolchain['name'] == SYSTEM_TOOLCHAIN_NAME:
1139+
cand_paths_filtered = []
1140+
for path in cand_paths:
1141+
tc_candidate = fetch_parameters_from_easyconfig(read_file(path), ['toolchain'])[0]
1142+
if isinstance(tc_candidate, dict) and toolchain_candidate['name'] == SYSTEM_TOOLCHAIN_NAME:
1143+
cand_paths_filtered += [path]
1144+
if isinstance(tc_candidate, string_type) and toolchain_candidate == "SYSTEM":
1145+
cand_paths_filtered += [path]
1146+
1147+
cand_paths = cand_paths_filtered
1148+
11351149
# add what is left to the possibilities
11361150
for path in cand_paths:
11371151
version = fetch_parameters_from_easyconfig(read_file(path), ['version'])[0]

0 commit comments

Comments
 (0)