Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions easybuild/framework/easyconfig/tweak.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,15 @@ def __repr__(self):
tweaks.update({'toolchain': TcDict({'name': toolchain['name'], 'version': toolchain['version']})})
_log.debug("New toolchain constructed: %s" % tweaks['toolchain'])

if 'toolchainopts' in keys:
extra_toolchainopts = tweaks['toolchainopts']
tco_regexp = re.compile(r"^\s*toolchainopts\s*=\s*(.*)$", re.M)
res = tco_regexp.search(ectxt)
toolchainopts = {} if not res else eval(res.group(1))
_log.debug("Appending %s toolchainopts to %s" % (extra_toolchainopts, toolchainopts))
toolchainopts.update(extra_toolchainopts)
tweaks.update({'toolchainopts': toolchainopts})

additions = []

# automagically clear out list of checksums if software version is being tweaked
Expand Down
11 changes: 11 additions & 0 deletions easybuild/tools/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ def override_options(self):
None, 'store_true', False),
'extra-modules': ("List of extra modules to load after setting up the build environment",
'strlist', 'extend', None),
'extra-toolchainopts': ("List of toolchain options to add", 'strlist', 'store', []),
'fetch': ("Allow downloading sources ignoring OS and modules tool dependencies, "
"implies --stop=fetch, --ignore-osdeps and ignore modules tool", None, 'store_true', False),
'filter-deps': ("List of dependencies that you do *not* want to install with EasyBuild, "
Expand Down Expand Up @@ -1331,6 +1332,16 @@ def process_software_build_specs(options):
value = value.split(',')
build_specs.update({param: value})

# process --extra-toolchainopts
if options.extra_toolchainopts:
try_to_generate = True

toolchainopts = {}
for spec in options.extra_toolchainopts:
param, value = spec.split('=')
toolchainopts.update({param: value})
build_specs.update({'toolchainopts': toolchainopts})

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case someone uses --extra-toolchains without arguments, is this caught somewhere?
If not, only set try_to_generate if toolchainopts is actually non-empty, and don't call build_specs.update if it is empty.

Or perhaps error out if it is empty?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for looking into this

if it is empty the options parser will error out saying that option it requires an argument

but if it is malformed, that's another issue, for instance if there is no '=' the split above will fail with no more values to unpack...

the correct usage allows something like --extra-toolchainopts=usempi=True,openmp=True,optarch="Intel:-O2;GCC=-O3", maybe this should be made clearer somewhere?

return (try_to_generate, build_specs)


Expand Down