-
Notifications
You must be signed in to change notification settings - Fork 219
fixing bug that could cause to silently overwrite an existing easyconfig when using --try-* #2635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
ac07b75
4a7b9d1
b299861
b69f2b0
54e7c20
1e8c2e0
05718cc
c90bee8
9fc02a2
abb8aa8
0c3e576
c7b3020
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,7 @@ | |
| :author: Toon Willems (Ghent University) | ||
| :author: Fotis Georgatos (Uni.Lu, NTUA) | ||
| :author: Alan O'Cais (Juelich Supercomputing Centre) | ||
| :author: Maxime Boissonneault (Universite Laval, Calcul Quebec, Compute Canada) | ||
| """ | ||
| import copy | ||
| import glob | ||
|
|
@@ -357,14 +358,7 @@ def __repr__(self): | |
| _log.debug("Generated file name for tweaked easyconfig file: %s", tweaked_ec) | ||
|
|
||
| # write out tweaked easyconfig file | ||
| if os.path.exists(tweaked_ec): | ||
| if build_option('force'): | ||
| print_warning("Overwriting existing file at %s with tweaked easyconfig file (due to --force)", tweaked_ec) | ||
| else: | ||
| raise EasyBuildError("A file already exists at %s where tweaked easyconfig file would be written", | ||
| tweaked_ec) | ||
|
|
||
| write_file(tweaked_ec, ectxt) | ||
| write_file(tweaked_ec, ectxt, backup=True, overwrite=False, verbose=True) | ||
|
||
| _log.info("Tweaked easyconfig file written to %s", tweaked_ec) | ||
|
|
||
| return tweaked_ec | ||
|
|
@@ -489,17 +483,17 @@ def select_or_generate_ec(fp, paths, specs): | |
| # TOOLCHAIN NAME | ||
|
|
||
| # we can't rely on set, because we also need to be able to obtain a list of unique lists | ||
| def unique(l): | ||
| def unique(lst): | ||
| """Retain unique elements in a sorted list.""" | ||
| l = sorted(l) | ||
| if len(l) > 1: | ||
| l2 = [l[0]] | ||
| for x in l: | ||
| if not x == l2[-1]: | ||
| l2.append(x) | ||
| return l2 | ||
| lst = sorted(lst) | ||
| if len(lst) > 1: | ||
| res = [lst[0]] | ||
| for x in lst: | ||
| if not x == res[-1]: | ||
| res.append(x) | ||
| return res | ||
| else: | ||
| return l | ||
| return lst | ||
|
|
||
| # determine list of unique toolchain names | ||
| tcnames = unique([x[0]['toolchain']['name'] for x in ecs_and_files]) | ||
|
|
@@ -856,7 +850,8 @@ def map_easyconfig_to_target_tc_hierarchy(ec_spec, toolchain_mapping, targetdir= | |
| # Determine the name of the modified easyconfig and dump it to target_dir | ||
| ec_filename = '%s-%s.eb' % (parsed_ec['ec']['name'], det_full_ec_version(parsed_ec['ec'])) | ||
| tweaked_spec = os.path.join(targetdir or tempfile.gettempdir(), ec_filename) | ||
| parsed_ec['ec'].dump(tweaked_spec) | ||
|
|
||
| parsed_ec['ec'].dump(tweaked_spec, overwrite=False, backup=True) | ||
|
||
| _log.debug("Dumped easyconfig tweaked via --try-toolchain* to %s", tweaked_spec) | ||
|
|
||
| return tweaked_spec | ||
Uh oh!
There was an error while loading. Please reload this page.