0

I have a standard_tasks.py module that provides a task for build

@task
def build(ctx):
    do_this()

from my tasks.py I am currently doing

from standard_tasks import *
_super_build = build.body

@task
def _build(ctx):
    # Here I want to call the older implementation that triggered do_this()
    _super_build(ctx)
    do_that()

build.body = _build

However, this feels clunky. I was wondering if there's a better way?

Stefano Borini
  • 138,652
  • 96
  • 297
  • 431
  • Would adding a [pre-task](http://docs.pyinvoke.org/en/stable/concepts/invoking-tasks.html#pre-and-post-tasks) to `_build` helps? – Sohaib Farooqi Sep 07 '20 at 15:29
  • @SohaibFarooqi not really because standard_tasks build() does not know anything about what specialised builds will need, and if I add an empty post_build task, I'm basically in the same situation for a differently named task – Stefano Borini Sep 07 '20 at 15:30

0 Answers0