blob: ff1f71dfd9a787cd987d655cbbe9a408be096f76 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
"""
fs.osfs.watch
=============
Change watcher support for OSFS
"""
import os
import sys
import errno
import threading
from fs.errors import *
from fs.path import *
from fs.watch import *
OSFSWatchMixin = None
# Try using native implementation on win32
if sys.platform == "win32":
try:
from fs.osfs.watch_win32 import OSFSWatchMixin
except ImportError:
pass
# Try using pyinotify if available
if OSFSWatchMixin is None:
try:
from fs.osfs.watch_inotify import OSFSWatchMixin
except ImportError:
pass
# Fall back to raising UnsupportedError
if OSFSWatchMixin is None:
class OSFSWatchMixin(object):
def __init__(self, *args, **kwargs):
super(OSFSWatchMixin, self).__init__(*args, **kwargs)
def add_watcher(self,*args,**kwds):
raise UnsupportedError
def del_watcher(self,watcher_or_callback):
raise UnsupportedError
|