-
Couldn't load subscription status.
- Fork 215
filter out duplicate paths added to module files #3770
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
filter out duplicate paths added to module files #3770
Conversation
|
@Flamefire conflict resolution needed |
1370d43 to
146773e
Compare
|
@akesandgren Rebased |
|
I can't find a new test that actually verifies that multiple copies of the same path actually gets filtered out. |
|
@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 |
|
Ok, there's so much code here that I just got lost :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
Going in, thanks @Flamefire! |
| 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", |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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... ;)
This basically fixes faulty EC files which result in modules like:
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