Skip to content

Commit d28ac52

Browse files
committed
Implement fully recursive file globing.
Python's base glob.iglob does not operate as if globstar were in effect. To explain, let's say I have an erlang application with lager logs to /var/log/erl_app/lags.log /var/log/erl_app/console/YEAR_MONTH_DAY.log and webmachine logs to /var/log/erl_app/webmachine/access/YEAR_MONTH_DAY.log Prior to this commit, when configured with the path `/var/log/**/*.log` all webmachine logs would be ignored by beaver. This is no longer the case, to an arbitrary depth. Signed-off-by: Brian L. Troutwine <brian@troutwine.us>
1 parent 8e14389 commit d28ac52

3 files changed

Lines changed: 4 additions & 2 deletions

File tree

beaver/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import argparse
2-
import glob
2+
import glob2
33
import itertools
44
import logging
55
import platform
@@ -95,7 +95,7 @@ def eglob(path):
9595
"""Like glob.glob, but supports "/path/**/{a,b,c}.txt" lookup"""
9696
fi = itertools.chain.from_iterable
9797
paths = expand_paths(path)
98-
return list(fi(glob.iglob(d) for d in paths))
98+
return list(fi(glob2.iglob(d) for d in paths))
9999

100100

101101
def expand_paths(path):

requirements/base.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ pika>=0.9.5
22
python-daemon>=1.5.2
33
redis==2.4.11
44
ujson>=1.9
5+
glob2==0.3

requirements/base26.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ pika>=0.9.5
33
python-daemon>=1.5.2
44
redis==2.4.11
55
ujson>=1.9
6+
glob2==0.3

0 commit comments

Comments
 (0)