Skip to content

Conversation

@Flamefire
Copy link
Contributor

@Flamefire Flamefire commented Jul 7, 2021

This basically fixes faulty EC files which result in modules like:

prepend_path("EBPYTHONPREFIXES", root)
prepend_path("QT_PLUGIN_PATH", pathJoin(root, "plugins"))
prepend_path("EBPYTHONPREFIXES", root)

The idea is to use a context manager around the creation of a module, store all added paths and reject duplicate ones that way clearing the stored paths at the end.

Testcase: PyQt5-5.9.2-foss-2018a-Python-3.6.4.eb

@akesandgren
Copy link
Contributor

@Flamefire conflict resolution needed

@Flamefire Flamefire force-pushed the duplicate_path_module branch from 1370d43 to 146773e Compare August 30, 2021 09:31
@Flamefire
Copy link
Contributor Author

@akesandgren Rebased

@easybuilders easybuilders deleted a comment from boegelbot Sep 1, 2021
@boegel boegel modified the milestones: 4.4.2, release after 4.4.2 Sep 2, 2021
@akesandgren
Copy link
Contributor

I can't find a new test that actually verifies that multiple copies of the same path actually gets filtered out.
Am I just not seeing it or is it missing?

@boegel boegel modified the milestones: 4.5.0, 4.x Oct 13, 2021
@Flamefire
Copy link
Contributor Author

@akesandgren Basically the test at https://github.com/easybuilders/easybuild-framework/pull/3770/files#diff-afa83d19ec1ee9ca4fd954c188c8e846c691fbcf4845d14e02d168a5f0cf359dL745 does test that. Maybe we can rework it to be a bit clearer in (test) intent but it certainly checks that the common case of adding a path multiple times to modgen.prepend_paths is filtered

@akesandgren
Copy link
Contributor

Ok, there's so much code here that I just got lost :-)

Copy link
Contributor

@akesandgren akesandgren left a comment

Choose a reason for hiding this comment

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

LGTM

@akesandgren akesandgren modified the milestones: 4.x, 4.5.0 (next release) Oct 21, 2021
@akesandgren
Copy link
Contributor

Going in, thanks @Flamefire!

@akesandgren akesandgren merged commit 4cde629 into easybuilders:develop Oct 21, 2021
@boegel boegel changed the title Filter out duplicate paths added to module files filter out duplicate paths added to module files Oct 27, 2021
filtered_paths = [x for x in paths if x not in added_paths and not added_paths.add(x)]
if filtered_paths != paths:
removed_paths = paths if filtered_paths is None else [x for x in paths if x not in filtered_paths]
print_warning("Supressed adding the following path(s) to $%s of the module as they were already added: %s",
Copy link
Member

Choose a reason for hiding this comment

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

Small typo here, should be Suppressed (double p); fixed in #3874

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. Always forget the double double letter in that word... ;)

@Flamefire Flamefire deleted the duplicate_path_module branch October 27, 2021 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants