doit support for newer versions

This commit is contained in:
boyska 2018-08-17 16:27:29 +02:00
parent 4e98f9ec9b
commit a146cf06af
2 changed files with 10 additions and 2 deletions

View file

@ -10,7 +10,7 @@ Serve installare le seguenti cosucce:
- docker
- docker-compose
- `go get 'github.com/betalo-sweden/await'` (serve Go >= 1.8)
- [doit](http://pydoit.org/) (`pip3 install doit` or `apt-get install python3-doit`)
- [doit](http://pydoit.org/) (`pip3 install doit==0.31` or `apt-get install python3-doit`)
## Lanciare

View file

@ -89,10 +89,18 @@ def run(cmd, **kwargs):
def run_task_func(taskf):
ret = taskf()
tasks = loader.generate_tasks(taskf.__name__, ret, taskf.__doc__)
try:
from doit.task import Stream
stream = Stream(0)
except ImportError:
stream = None
def fun():
for task in tasks:
task.execute()
if stream is None:
task.execute()
else:
task.execute(stream)
return True
if tasks:
fun.__doc__ = '\n'.join(t.doc for t in tasks)