77from paths_cli .compiling .plugins import (
88 CategoryPlugin , InstanceCompilerPlugin
99)
10- from paths_cli .plugin_management import (
11- NamespacePluginLoader , FilePluginLoader
12- )
10+ from paths_cli .plugin_management import NamespacePluginLoader
1311import importlib
14- from paths_cli .utils import app_dir_plugins
12+ from paths_cli .utils import get_installed_plugins
1513
1614# this is just to handle a nicer error
1715def import_module (module_name , format_type = None , install = None ):
@@ -40,7 +38,7 @@ def load_json(f):
4038# https://github.com/toml-lang/toml/issues/553#issuecomment-444814690
4139# Conflicts with rules preventing mixed types in arrays. This seems to have
4240# relaxed in TOML 1.0, but the toml package doesn't support the 1.0
43- # standard. We'll add toml in once the pacakge supports the standard.
41+ # standard. We'll add toml in once the package supports the standard.
4442
4543EXTENSIONS = {
4644 'yaml' : load_yaml ,
@@ -57,17 +55,6 @@ def select_loader(filename):
5755 except KeyError :
5856 raise RuntimeError (f"Unknown file extension: { ext } " )
5957
60- def load_plugins ():
61- plugin_types = (InstanceCompilerPlugin , CategoryPlugin )
62- plugin_loaders = [
63- NamespacePluginLoader ('paths_cli.compiling' , plugin_types ),
64- FilePluginLoader (app_dir_plugins (posix = False ), plugin_types ),
65- FilePluginLoader (app_dir_plugins (posix = True ), plugin_types ),
66- NamespacePluginLoader ('paths_cli_plugins' , plugin_types )
67- ]
68- plugins = sum ([loader () for loader in plugin_loaders ], [])
69- return plugins
70-
7158@click .command (
7259 'compile' ,
7360)
@@ -78,7 +65,12 @@ def compile_(input_file, output_file):
7865 with open (input_file , mode = 'r' ) as f :
7966 dct = loader (f )
8067
81- plugins = load_plugins ()
68+ plugin_types = (InstanceCompilerPlugin , CategoryPlugin )
69+ plugins = get_installed_plugins (
70+ default_loader = NamespacePluginLoader ('paths_cli.compiling' ,
71+ plugin_types ),
72+ plugin_types = plugin_types
73+ )
8274 register_plugins (plugins )
8375
8476 objs = do_compile (dct )
0 commit comments