mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #15095 from jjshoe/sort_plugins
Sort plugins by basename to support ordering callbacks
This commit is contained in:
commit
2f118e546f
1 changed files with 27 additions and 25 deletions
|
@ -348,10 +348,12 @@ class PluginLoader:
|
||||||
''' instantiates all plugins with the same arguments '''
|
''' instantiates all plugins with the same arguments '''
|
||||||
|
|
||||||
class_only = kwargs.pop('class_only', False)
|
class_only = kwargs.pop('class_only', False)
|
||||||
|
all_matches = []
|
||||||
|
|
||||||
for i in self._get_paths():
|
for i in self._get_paths():
|
||||||
matches = glob.glob(os.path.join(i, "*.py"))
|
all_matches.extend(glob.glob(os.path.join(i, "*.py")))
|
||||||
matches.sort()
|
|
||||||
for path in matches:
|
for path in sorted(all_matches, key=lambda match: os.path.basename(match)):
|
||||||
name, _ = os.path.splitext(path)
|
name, _ = os.path.splitext(path)
|
||||||
if '__init__' in name:
|
if '__init__' in name:
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in a new issue