|
From: | Hajducko, Steven |
Subject: | Re: [Fab-user] Exposed tasks via @task |
Date: | Tue, 20 Dec 2011 10:15:36 -0800 |
Try using __all__ utils.py: __all__ = [‘which’] frobnosticate.py: __all__ = [‘frobber’] http://docs.fabfile.org/en/1.3.3/usage/tasks.html?highlight=__all__ You really don’t even need the __all__ in the utils.py. fabfile/__init__.py: import frobnosticate import utils fabfile/utils.py: from fabric.api import * @task def which(): pass fabfile/frobnosticate.py: from fabric.api import * from test import which __all__ = ['frobber'] @task def frobber(): which() loki:fabtest stha3155$ fab -l Available commands: frobnosticate.frobber utils.which From: address@hidden [mailto:address@hidden On Behalf Of VanL Is there a way to limit tasks to the context in which they are exposed? For example, I like to build up a number of subfunctions that may be individually useful, mark them as @tasks, and then have higher-level tasks that use a number of these subfunctions to perform some scripted action. If the subfunction task is imported from another module, it results in the task name being repeated in both contexts. For example: |
[Prev in Thread] | Current Thread | [Next in Thread] |