def wait_pyinotify(self, bld):
class PE(w_pyinotify.ProcessEvent):
def stop(self, event):
self.notif.ev = True
self.notif.stop()
raise ValueError("stop for delete")
process_IN_DELETE = stop
process_IN_CLOSE = stop
process_default = stop
proc = PE()
wm = w_pyinotify.WatchManager()
notif = w_pyinotify.Notifier(wm, proc)
proc.notif = notif
# well, we should add all the folders to watch here
for x in self.enumerate(bld.srcnode):
wm.add_watch(x, w_pyinotify.IN_DELETE | w_pyinotify.IN_CLOSE_WRITE)
try:
# pyinotify uses an infinite loop ... not too nice, so we have to use an exception
notif.loop()
except ValueError:
pass
if not hasattr(notif, 'ev'):
raise KeyboardInterrupt
评论列表
文章目录