From 46baadb8a19fed47dc1120ed2c6ad622750fd497 Mon Sep 17 00:00:00 2001 From: boyska Date: Wed, 5 Sep 2018 16:53:04 +0200 Subject: [PATCH] FIX doit for docker/ subdirs --- dodo.py | 5 ++--- dodo_utils.py | 10 ++++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/dodo.py b/dodo.py index 1cc3ef5..af562bf 100644 --- a/dodo.py +++ b/dodo.py @@ -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)], diff --git a/dodo_utils.py b/dodo_utils.py index 215821c..66734db 100644 --- a/dodo_utils.py +++ b/dodo_utils.py @@ -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)