3434from cppython .data import Data , Plugins
3535from cppython .defaults import DefaultSCM
3636from cppython .utility .exception import PluginError
37+ from cppython .utility .utility import TypeName
3738
3839
3940class Resolver :
@@ -59,14 +60,14 @@ def generate_plugins(
5960 raw_generator_plugins = self .find_generators ()
6061 generator_plugins = self .filter_plugins (
6162 raw_generator_plugins ,
62- cppython_local_configuration . generator_name ,
63+ self . _get_effective_generator_name ( cppython_local_configuration ) ,
6364 'Generator' ,
6465 )
6566
6667 raw_provider_plugins = self .find_providers ()
6768 provider_plugins = self .filter_plugins (
6869 raw_provider_plugins ,
69- cppython_local_configuration . provider_name ,
70+ self . _get_effective_provider_name ( cppython_local_configuration ) ,
7071 'Provider' ,
7172 )
7273
@@ -79,6 +80,74 @@ def generate_plugins(
7980
8081 return PluginBuildData (generator_type = generator_type , provider_type = provider_type , scm_type = scm_type )
8182
83+ def _get_effective_generator_name (self , config : CPPythonLocalConfiguration ) -> str | None :
84+ """Get the effective generator name from configuration
85+
86+ Args:
87+ config: The local configuration
88+
89+ Returns:
90+ The generator name to use, or None for auto-detection
91+ """
92+ if config .generators :
93+ # For now, pick the first generator (in future, could support selection logic)
94+ return list (config .generators .keys ())[0 ]
95+
96+ # No generators specified, use auto-detection
97+ return None
98+
99+ def _get_effective_provider_name (self , config : CPPythonLocalConfiguration ) -> str | None :
100+ """Get the effective provider name from configuration
101+
102+ Args:
103+ config: The local configuration
104+
105+ Returns:
106+ The provider name to use, or None for auto-detection
107+ """
108+ if config .providers :
109+ # For now, pick the first provider (in future, could support selection logic)
110+ return list (config .providers .keys ())[0 ]
111+
112+ # No providers specified, use auto-detection
113+ return None
114+
115+ def _get_effective_generator_config (
116+ self , config : CPPythonLocalConfiguration , generator_name : str
117+ ) -> dict [str , Any ]:
118+ """Get the effective generator configuration
119+
120+ Args:
121+ config: The local configuration
122+ generator_name: The name of the generator being used
123+
124+ Returns:
125+ The configuration dict for the generator
126+ """
127+ generator_type_name = TypeName (generator_name )
128+ if config .generators and generator_type_name in config .generators :
129+ return config .generators [generator_type_name ]
130+
131+ # Return empty config if not found
132+ return {}
133+
134+ def _get_effective_provider_config (self , config : CPPythonLocalConfiguration , provider_name : str ) -> dict [str , Any ]:
135+ """Get the effective provider configuration
136+
137+ Args:
138+ config: The local configuration
139+ provider_name: The name of the provider being used
140+
141+ Returns:
142+ The configuration dict for the provider
143+ """
144+ provider_type_name = TypeName (provider_name )
145+ if config .providers and provider_type_name in config .providers :
146+ return config .providers [provider_type_name ]
147+
148+ # Return empty config if not found
149+ return {}
150+
82151 @staticmethod
83152 def generate_cppython_plugin_data (plugin_build_data : PluginBuildData ) -> PluginCPPythonData :
84153 """Generates the CPPython plugin data from the resolved plugins
@@ -447,11 +516,18 @@ def build(
447516 pep621_data = self ._resolver .generate_pep621_data (pep621_configuration , self ._project_configuration , scm )
448517
449518 # Create the chosen plugins
519+ generator_config = self ._resolver ._get_effective_generator_config (
520+ cppython_local_configuration , plugin_build_data .generator_type .name ()
521+ )
450522 generator = self ._resolver .create_generator (
451- core_data , pep621_data , cppython_local_configuration .generator , plugin_build_data .generator_type
523+ core_data , pep621_data , generator_config , plugin_build_data .generator_type
524+ )
525+
526+ provider_config = self ._resolver ._get_effective_provider_config (
527+ cppython_local_configuration , plugin_build_data .provider_type .name ()
452528 )
453529 provider = self ._resolver .create_provider (
454- core_data , pep621_data , cppython_local_configuration . provider , plugin_build_data .provider_type
530+ core_data , pep621_data , provider_config , plugin_build_data .provider_type
455531 )
456532
457533 plugins = Plugins (generator = generator , provider = provider , scm = scm )
0 commit comments