FIX doit for docker/ subdirs

This commit is contained in:
boyska 2018-09-05 16:53:04 +02:00
parent 54bcd8dbb8
commit 46baadb8a1
2 changed files with 12 additions and 3 deletions

View file

@ -5,7 +5,7 @@ from doit.tools import LongRunning
from dodo_utils import wait_net_service, wait_pgsql_db, \
up2date_hasimage, up2date_anyimages, \
run_task_func
run_task_func, scan_dir
COMPOSE = 'docker-compose -p feedati'
DOIT_CONFIG = {'default_tasks': ['up']}
@ -17,8 +17,7 @@ def task_build():
'uptodate': [up2date_anyimages],
'file_dep': ['docker-compose.yml',
'rss-bridge/Dockerfile',
] + [os.path.join('docker', fname)
for fname in os.listdir('docker')],
] + list(scan_dir('docker')),
'actions': [COMPOSE + ' build'],
'clean': [run_task_func(task__build_rm),
run_task_func(task__build_rmi)],

View file

@ -1,5 +1,7 @@
import subprocess
import time
import os
import fnmatch
from doit import loader
@ -105,3 +107,11 @@ def run_task_func(taskf):
if tasks:
fun.__doc__ = '\n'.join(t.doc for t in tasks)
return fun
def scan_dir(dirname, extension=None):
if extension is None:
extension = '*'
for root, dirnames, filenames in os.walk(dirname):
for fname in fnmatch.filter(filenames, extension):
yield os.path.join(root, fname)