Skip to content

Commit 7027f32

Browse files
author
ocaisa
authored
Merge pull request #3325 from ComputeCanada/fix_tweak
A couple of bug fixes with `tweak.py` for `--try-update-deps`
2 parents 70b86fa + f1494b0 commit 7027f32

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

easybuild/framework/easyconfig/tweak.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,13 @@
5252
from easybuild.framework.easyconfig.format.format import DEPENDENCY_PARAMETERS
5353
from easybuild.framework.easyconfig.parser import fetch_parameters_from_easyconfig
5454
from easybuild.framework.easyconfig.tools import alt_easyconfig_paths
55+
from easybuild.toolchains.compiler.systemcompiler import TC_CONSTANT_SYSTEM
5556
from easybuild.toolchains.gcccore import GCCcore
5657
from easybuild.tools.build_log import EasyBuildError, print_warning
5758
from easybuild.tools.config import build_option
5859
from easybuild.tools.filetools import read_file, write_file
5960
from easybuild.tools.module_naming_scheme.utilities import det_full_ec_version
61+
from easybuild.tools.py2vs3 import string_type
6062
from easybuild.tools.robot import resolve_dependencies, robot_find_easyconfig, search_easyconfigs
6163
from easybuild.tools.toolchain.toolchain import SYSTEM_TOOLCHAIN_NAME
6264
from easybuild.tools.toolchain.toolchain import TOOLCHAIN_CAPABILITIES
@@ -1089,6 +1091,9 @@ def find_potential_version_mappings(dep, toolchain_mapping, versionsuffix_mappin
10891091

10901092
# Figure out the main versionsuffix (altered depending on toolchain in the loop below)
10911093
versionsuffix = dep.get('versionsuffix', '')
1094+
# If versionsuffix is equal to None, it should be put to empty string
1095+
if versionsuffix is None:
1096+
versionsuffix = ''
10921097
# If versionsuffix is in our mapping then we expect it to be updated
10931098
if versionsuffix in versionsuffix_mapping:
10941099
versionsuffix = versionsuffix_mapping[versionsuffix]
@@ -1105,14 +1110,12 @@ def find_potential_version_mappings(dep, toolchain_mapping, versionsuffix_mappin
11051110
if len(version_components) > 1: # Have at least major.minor
11061111
candidate_ver_list.append(r'%s\..*' % major_version)
11071112
candidate_ver_list.append(r'.*') # Include a major version search
1108-
11091113
potential_version_mappings, highest_version = [], None
11101114

11111115
for candidate_ver in candidate_ver_list:
11121116

11131117
# if any potential version mappings were found already at this point, we don't add more
11141118
if not potential_version_mappings:
1115-
11161119
for toolchain in toolchain_hierarchy:
11171120

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

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

0 commit comments

Comments
 (0)