Commit 17b72215 by rfkelly0

some python2.5 compatability fixes; thanks Andrew Scheller

parent a3a4bd92
......@@ -24,6 +24,8 @@ is, you probably don't want to use it.
"""
from __future__ import with_statement
import os
import stat as statinfo
import time
......
import json
import urlparse
import mimetypes
......
......@@ -957,7 +957,7 @@ class FTPFS(FS):
def _open_ftp(self):
try:
ftp = FTP()
if self.default_timeout:
if self.default_timeout or sys.version_info < (2,6,):
ftp.connect(self.host, self.port)
else:
ftp.connect(self.host, self.port, self.timeout)
......
......@@ -24,6 +24,10 @@ except Exception, e:
if isinstance(e,ImportError):
raise
raise ImportError("could not import pyinotify")
try:
pyinotify.WatchManager.get_fd
except AttributeError:
raise ImportError("pyinotify version is too old")
class OSFSWatchMixin(WatchableFSMixin):
......
......@@ -574,7 +574,7 @@ def iswildcard(path):
"""
assert path is not None
base_chars = frozenset(basename(path))
return not base_chars.isdisjoint(_wild_chars)
return bool(base_chars.intersection(_wild_chars))
if __name__ == "__main__":
print recursepath('a/b/c')
......@@ -36,7 +36,15 @@ class LazyFS(WrapFS):
try:
wrapped_fs = self.__dict__["wrapped_fs"]
except KeyError:
# It appears that python2.5 has trouble printing out
# classes that define a __unicode__ method.
try:
return u"<LazyFS: %s>" % (self._fsclass,)
except TypeError:
try:
return u"<LazyFS: %s>" % (self._fsclass.__name__,)
except AttributeError:
return u"<LazyFS: <unprintable>>"
else:
return u"<LazyFS: %s>" % (wrapped_fs,)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment