Skip to content

Commit e384579

Browse files
committed
enhance install_extension_substep to support passing down (named) arguments
1 parent 0bee2ec commit e384579

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

easybuild/framework/extension.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -223,41 +223,44 @@ def post_install_extension(self):
223223
"""
224224
self.master.run_post_install_commands(commands=self.cfg.get('postinstallcmds', []))
225225

226-
def install_extension_substep(self, substep):
226+
def install_extension_substep(self, substep, *args, **kwargs):
227227
"""
228228
Carry out extension installation substep allowing use of deprecated
229229
methods on those extensions using an older EasyBlock
230230
"""
231-
deprecated = {
231+
substeps_mapping = {
232232
'pre_install_extension': 'prerun',
233233
'install_extension': 'run',
234234
'install_extension_async': 'run_async',
235235
'post_install_extension': 'postrun',
236236
}
237237

238-
if substep not in deprecated:
238+
deprecated_method = substeps_mapping.get(substep)
239+
if deprecated_method is None:
239240
raise EasyBuildError("Unknown extension installation substep: %s", substep)
240241

241242
try:
242-
ext_substep = getattr(self, deprecated[substep])
243+
ext_substep = getattr(self, deprecated_method)
243244
parent_obj = super(self.__class__, self)
244-
parent_substep = getattr(parent_obj, deprecated[substep])
245+
parent_substep = getattr(parent_obj, deprecated_method)
245246
except AttributeError:
246-
self.log.debug("Easyblock does not provide deprecated method for installation substep: %s", substep)
247+
log_msg = f"EasyBlock does not implement deprecated method '{deprecated_method}' "
248+
log_msg += f"for installation substep {substep}"
249+
self.log.debug(log_msg)
247250
ext_substep = getattr(self, substep)
248251
else:
249252
if ext_substep.__hash__() == parent_substep.__hash__():
250253
# Deprecated method is present in parent, but no custom method in child Easyblock
251254
ext_substep = getattr(self, substep)
252255
else:
253256
# Custom deprecated method used by child Easyblock
254-
self.log.debug("Easyblock provides custom deprecated method for installation substep: %s", substep)
257+
self.log.debug(f"EasyBlock provides custom deprecated method for installation substep: {substep}")
255258
self.log.deprecated(
256259
f"Extension.{deprecated[substep]}() is deprecated, use Extension.{substep}() instead.",
257260
"6.0",
258261
)
259262

260-
return ext_substep()
263+
return ext_substep(*args, **kwargs)
261264

262265
def async_cmd_start(self, cmd, inp=None):
263266
"""

0 commit comments

Comments
 (0)