Exemplo n.º 1
0
def start_session():
    observer = Observer()
    observer.start()

    cb = create_cb()

    stream = Stream(cb, os.getcwd(), file_events=True)
    observer.schedule(stream)
    observer.run()
Exemplo n.º 2
0
    def start_watching(self):
        """ Start watching our paths, and do the main work. """
        # setup
        observer = Observer()
        stream = Stream(
                self.capture_event,
                self.settings['local']['watch_path'],
                file_events=True
                )
        observer.schedule(stream)

        # go go go
        observer.run()
Exemplo n.º 3
0
    def _loop_darwin(self): # pragma: no cover
        """loop implementation for darwin platform"""
        from fsevents import Observer #pylint: disable=F0401
        from fsevents import Stream #pylint: disable=F0401
        from fsevents import IN_MODIFY #pylint: disable=F0401

        observer = Observer()
        handler = self._handle
        def fsevent_callback(event):
            if event.mask == IN_MODIFY:
                handler(event)

        for watch_this in self.watch_dirs:
            stream = Stream(fsevent_callback, watch_this, file_events=True)
            observer.schedule(stream)

        observer.daemon = True
        observer.run()
Exemplo n.º 4
0
    def _loop_darwin(self):  # pragma: no cover
        """loop implementation for darwin platform"""
        from fsevents import Observer  #pylint: disable=F0401
        from fsevents import Stream  #pylint: disable=F0401
        from fsevents import IN_MODIFY  #pylint: disable=F0401

        observer = Observer()
        handler = self._handle

        def fsevent_callback(event):
            if event.mask == IN_MODIFY:
                handler(event)

        for watch_this in self.watch_dirs:
            stream = Stream(fsevent_callback, watch_this, file_events=True)
            observer.schedule(stream)

        observer.daemon = True
        observer.run()
Exemplo n.º 5
0
#!/usr/bin/env python
import subprocess
import sys

from fsevents import Observer
from fsevents import Stream

if len(sys.argv) != 2:
    print 'Usage: %s [absolute path to searchfe]' % sys.argv[0]
    sys.exit(1)

observer = Observer()

def callback(args):
    print args
    subprocess.call([sys.argv[1] + '/bin/searchfe.sh', 'less'])

stream = Stream(callback, sys.argv[1] + '/al/marbury/less', file_events=True)
observer.schedule(stream)
observer.run()
Exemplo n.º 6
0
        ])
        print "compile gss %s to %s " % (infile, outfile)
    if (path.endswith(".touch_index")):
        update_index_html()
    if (update_index):
        global_update_index = True
        os.utime("%s.touch_index" % root, None)


def callback(e):
    name = e.name
    cookie = e.cookie
    mask = e.mask
    processor(name)


for subdir, dir, files in os.walk(root):
    for file in files:
        path = "%s/%s" % (subdir, file)
        processor(path)

update_index_html()

try:
    observer = Observer()
    stream = Stream(callback, root, file_events=True)
    observer.schedule(stream)
    observer.run()
except:
    observer.stop()