@@ -76,6 +76,21 @@ def resolve_pep621(
7676 return pep621_data
7777
7878
79+ def _resolve_absolute_path (path : Path , root_directory : Path ) -> Path :
80+ """Convert a path to absolute, using root_directory as base for relative paths.
81+
82+ Args:
83+ path: The path to resolve
84+ root_directory: The base directory for relative paths
85+
86+ Returns:
87+ The absolute path
88+ """
89+ if path .is_absolute ():
90+ return path
91+ return root_directory / path
92+
93+
7994class PluginBuildData (CPPythonModel ):
8095 """Data needed to construct CoreData"""
8196
@@ -114,34 +129,20 @@ def resolve_cppython(
114129 """
115130 root_directory = project_data .project_root .absolute ()
116131
117- # Add the base path to all relative paths
132+ # Resolve configuration path
118133 modified_configuration_path = local_configuration .configuration_path
119-
120- # TODO: Grab configuration from the project, user, or system
121134 if modified_configuration_path is None :
122135 modified_configuration_path = root_directory / 'cppython.json'
136+ else :
137+ modified_configuration_path = _resolve_absolute_path (modified_configuration_path , root_directory )
123138
124- if not modified_configuration_path .is_absolute ():
125- modified_configuration_path = root_directory / modified_configuration_path
126-
127- modified_install_path = local_configuration .install_path
128-
129- if not modified_install_path .is_absolute ():
130- modified_install_path = root_directory / modified_install_path
131-
132- modified_tool_path = local_configuration .tool_path
133-
134- if not modified_tool_path .is_absolute ():
135- modified_tool_path = root_directory / modified_tool_path
136-
137- modified_build_path = local_configuration .build_path
138-
139- if not modified_build_path .is_absolute ():
140- modified_build_path = root_directory / modified_build_path
139+ # Resolve other paths
140+ modified_install_path = _resolve_absolute_path (local_configuration .install_path , root_directory )
141+ modified_tool_path = _resolve_absolute_path (local_configuration .tool_path , root_directory )
142+ modified_build_path = _resolve_absolute_path (local_configuration .build_path , root_directory )
141143
142144 modified_provider_name = plugin_build_data .provider_name
143145 modified_generator_name = plugin_build_data .generator_name
144-
145146 modified_scm_name = plugin_build_data .scm_name
146147
147148 # Extract provider and generator configuration data
@@ -166,6 +167,18 @@ def resolve_cppython(
166167 except InvalidRequirement as error :
167168 invalid_requirements .append (f"Invalid requirement '{ dependency } ': { error } " )
168169
170+ # Construct dependency groups from the local configuration
171+ dependency_groups : dict [str , list [Requirement ]] = {}
172+ if local_configuration .dependency_groups :
173+ for group_name , group_dependencies in local_configuration .dependency_groups .items ():
174+ resolved_group : list [Requirement ] = []
175+ for dependency in group_dependencies :
176+ try :
177+ resolved_group .append (Requirement (dependency ))
178+ except InvalidRequirement as error :
179+ invalid_requirements .append (f"Invalid requirement '{ dependency } ' in group '{ group_name } ': { error } " )
180+ dependency_groups [group_name ] = resolved_group
181+
169182 if invalid_requirements :
170183 raise ConfigException ('\n ' .join (invalid_requirements ), [])
171184
@@ -179,6 +192,7 @@ def resolve_cppython(
179192 generator_name = modified_generator_name ,
180193 scm_name = modified_scm_name ,
181194 dependencies = dependencies ,
195+ dependency_groups = dependency_groups ,
182196 provider_data = provider_data ,
183197 generator_data = generator_data ,
184198 )
@@ -208,6 +222,7 @@ def resolve_cppython_plugin(cppython_data: CPPythonData, plugin_type: type[Plugi
208222 generator_name = cppython_data .generator_name ,
209223 scm_name = cppython_data .scm_name ,
210224 dependencies = cppython_data .dependencies ,
225+ dependency_groups = cppython_data .dependency_groups ,
211226 provider_data = cppython_data .provider_data ,
212227 generator_data = cppython_data .generator_data ,
213228 )
0 commit comments