@@ -57,10 +57,15 @@ def __init__(self, application_name):
57
57
self .config = defaultdict (dict )
58
58
self ._application_name = application_name
59
59
60
- def loads (self , config_filenames ):
60
+ def loads (self , config_filenames , toml_config_files_prefix ):
61
61
for config_filename in config_filenames :
62
62
if str (config_filename ).lower ().endswith ('.toml' ):
63
- prefix = f"tool.{ self ._application_name } " if config_filename == 'pyproject.toml' else ''
63
+ if toml_config_files_prefix :
64
+ prefix = toml_config_files_prefix
65
+ elif config_filename == 'pyproject.toml' :
66
+ prefix = f'tool.{ self ._application_name } '
67
+ else :
68
+ prefix = ''
64
69
toml_config = self .load_config_toml (config_filename , prefix )
65
70
for section in toml_config :
66
71
self .config [section ].update (toml_config [section ].items ())
@@ -161,7 +166,8 @@ class DoitMain(object):
161
166
def __init__ (self , task_loader = None ,
162
167
config_filenames = ('pyproject.toml' , 'doit.cfg' ),
163
168
extra_config = None ,
164
- application_name = 'doit' ):
169
+ application_name = 'doit' ,
170
+ toml_config_files_prefix = None ):
165
171
"""
166
172
:param extra_config: dict of extra argument values (by argument name)
167
173
This is parameter is only used by explicit API call.
@@ -182,7 +188,7 @@ def __init__(self, task_loader=None,
182
188
183
189
# combine config option from INI/TOML files and API
184
190
config_in = DoitConfig (application_name )
185
- config_in .loads (config_filenames )
191
+ config_in .loads (config_filenames , toml_config_files_prefix = toml_config_files_prefix )
186
192
for section , vals in config_in .as_dict ().items ():
187
193
self .config [section ].update (vals )
188
194
0 commit comments