14 """Helper to watch a (set) of directories for modifications."""
19 from six
import string_types
23 """Helper to watch a (set) of directories for modifications."""
26 if isinstance(paths, string_types):
34 """Walk over all subscribed paths, check most recent mtime."""
35 most_recent_change =
None
36 for path
in self.
paths:
37 if not os.path.exists(path):
39 if not os.path.isdir(path):
41 for root, _, files
in os.walk(path):
46 st = os.stat(os.path.join(root, f))
48 if e.errno == os.errno.ENOENT:
51 if most_recent_change
is None:
52 most_recent_change = st.st_mtime
54 most_recent_change =
max(most_recent_change,
56 return most_recent_change
59 if time.time() - self.
lastrun > 1: