Skip to content

Commit 90ed290

Browse files
committed
separate compile's register_installed_plugins
(for re-use by other parts of the code)
1 parent d2ee0a2 commit 90ed290

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

‎paths_cli/commands/compile.py‎

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,16 @@ def select_loader(filename):
5656
except KeyError:
5757
raise RuntimeError(f"Unknown file extension: {ext}")
5858

59+
def register_installed_plugins():
60+
plugin_types = (InstanceCompilerPlugin, CategoryPlugin)
61+
plugins = get_installed_plugins(
62+
default_loader=NamespacePluginLoader('paths_cli.compiling',
63+
plugin_types),
64+
plugin_types=plugin_types
65+
)
66+
register_plugins(plugins)
67+
68+
5969
@click.command(
6070
'compile',
6171
)
@@ -66,13 +76,7 @@ def compile_(input_file, output_file):
6676
with open(input_file, mode='r') as f:
6777
dct = loader(f)
6878

69-
plugin_types = (InstanceCompilerPlugin, CategoryPlugin)
70-
plugins = get_installed_plugins(
71-
default_loader=NamespacePluginLoader('paths_cli.compiling',
72-
plugin_types),
73-
plugin_types=plugin_types
74-
)
75-
register_plugins(plugins)
79+
register_installed_plugins()
7680

7781
objs = do_compile(dct)
7882
print(f"Saving {len(objs)} user-specified objects to {output_file}....")

0 commit comments

Comments
 (0)