diff options
author | John Swinbank <john@swinbank.org> | 2013-11-19 14:16:14 +0100 |
---|---|---|
committer | John Swinbank <john@swinbank.org> | 2013-11-19 14:21:52 +0100 |
commit | 99059317f3cbfd25aeb7a03394ff6713ddbb451a (patch) | |
tree | 81b95591d82c1a18a88face441dceda380818d39 /python2 | |
parent | b828a124bcf2310df7e2e7683b0902fcd78a08bf (diff) | |
download | pyinotify-99059317f3cbfd25aeb7a03394ff6713ddbb451a.tar.gz |
Fall back to glob.glob() on Python 2.4
glob.iglob() was introduced with Python 2.5, but pyinotify claims
compatibility with Python 2.4. Here, we fall back to glob.glob() if iglob()
isn't available.
Diffstat (limited to 'python2')
-rwxr-xr-x | python2/pyinotify.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/python2/pyinotify.py b/python2/pyinotify.py index aa9c148..7d6b05f 100755 --- a/python2/pyinotify.py +++ b/python2/pyinotify.py @@ -68,7 +68,6 @@ from datetime import datetime, timedelta import time import re import asyncore -import glob import subprocess try: @@ -77,6 +76,12 @@ except ImportError: pass # Will fail on Python 2.4 which has reduce() builtin anyway. try: + from glob import iglob as glob +except ImportError: + # Python 2.4 does not have glob.iglob(). + from glob import glob as glob + +try: import ctypes import ctypes.util except ImportError: @@ -1830,7 +1835,7 @@ class WatchManager: def __glob(self, path, do_glob): if do_glob: - return glob.iglob(path) + return glob(path) else: return [path] |