-
Notifications
You must be signed in to change notification settings - Fork 18
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
Add topological sort option to list* commands #62
Add topological sort option to list* commands #62
Conversation
I see |
e280f9a
to
a3b1a4e
Compare
This is taking shape. Can you add tests for the sorters and update the documentation too? |
a3b1a4e
to
748eda0
Compare
Can you also
|
748eda0
to
b10263d
Compare
9512cd2
to
ca6b019
Compare
088598d
to
886f034
Compare
src/manifestoo/addon_sorter.py
Outdated
result_dict[addon_name] = set( | ||
[ | ||
depend | ||
for depend in addon.manifest.depends | ||
if depend in addons_selection | ||
] | ||
) |
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.
result_dict[addon_name] = set( | |
[ | |
depend | |
for depend in addon.manifest.depends | |
if depend in addons_selection | |
] | |
) | |
result_dict[addon_name] = set( | |
depend | |
for depend in addon.manifest.depends | |
if depend in addons_selection | |
) |
result: Set[str] = set(addons_selection) if include_selected else set() | ||
codeps = direct_codependencies(addons_selection, addons_set, result) | ||
result |= codeps | ||
while transitive and codeps: | ||
codeps = direct_codependencies(codeps, addons_set, result) | ||
result |= codeps | ||
return result if include_selected else result - addons_selection | ||
res = result if include_selected else result - set(addons_selection) |
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.
res = result if include_selected else result - set(addons_selection) | |
res = result if include_selected else result - addons_selection |
This change was not necessary?
result: Set[str] = set(addons_selection) if include_selected else set() | ||
codeps = direct_codependencies(addons_selection, addons_set, result) | ||
result |= codeps | ||
while transitive and codeps: | ||
codeps = direct_codependencies(codeps, addons_set, result) | ||
result |= codeps | ||
return result if include_selected else result - addons_selection | ||
res = result if include_selected else result - set(addons_selection) | ||
return set(addon_sorter.sort(res, addons_set)) |
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.
return set(addon_sorter.sort(res, addons_set)) | |
return addon_sorter.sort(res, addons_set) |
Set would defeat the sorting.
src/manifestoo/main.py
Outdated
"--sorting", | ||
"--sort", |
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.
"--sorting", | |
"--sort", | |
"--sort", |
--sorting
sounds a bit strange to me. Not sure.
src/manifestoo/main.py
Outdated
"--sorting", | ||
"--sort", | ||
help=( | ||
"Choice between 'alphabetical' and 'topological'." |
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.
"Choice between 'alphabetical' and 'topological'." | |
"Choice between 'alphabetical' and 'topological'. " |
Also for the 2 others
886f034
to
b304897
Compare
Add a new --sort option on the list-depend command allowing to apply a topological sorting to the result.
https://docs.python.org/3/library/graphlib.html