Only reload source code on create and change event
This commit is contained in:
parent
dcbac42571
commit
20fb9ab97d
1 changed files with 7 additions and 5 deletions
|
@ -6,9 +6,10 @@ from Config import config
|
||||||
|
|
||||||
if config.debug: # Only load pyfilesytem if using debug mode
|
if config.debug: # Only load pyfilesytem if using debug mode
|
||||||
try:
|
try:
|
||||||
from fs.osfs import OSFS
|
import fs.watch
|
||||||
pyfilesystem = OSFS("src")
|
import fs.osfs
|
||||||
pyfilesystem_plugins = OSFS("plugins")
|
pyfilesystem = fs.osfs.OSFS("src")
|
||||||
|
pyfilesystem_plugins = fs.osfs.OSFS("plugins")
|
||||||
logging.debug("Pyfilesystem detected, source code autoreload enabled")
|
logging.debug("Pyfilesystem detected, source code autoreload enabled")
|
||||||
except Exception, err:
|
except Exception, err:
|
||||||
pyfilesystem = False
|
pyfilesystem = False
|
||||||
|
@ -32,8 +33,9 @@ class DebugReloader:
|
||||||
def addWatcher(self, recursive=True):
|
def addWatcher(self, recursive=True):
|
||||||
try:
|
try:
|
||||||
time.sleep(1) # Wait for .pyc compiles
|
time.sleep(1) # Wait for .pyc compiles
|
||||||
pyfilesystem.add_watcher(self.changed, path=self.directory, events=None, recursive=recursive)
|
watch_events = [fs.watch.CREATED, fs.watch.MODIFIED]
|
||||||
pyfilesystem_plugins.add_watcher(self.changed, path=self.directory, events=None, recursive=recursive)
|
pyfilesystem.add_watcher(self.changed, path=self.directory, events=watch_events, recursive=recursive)
|
||||||
|
pyfilesystem_plugins.add_watcher(self.changed, path=self.directory, events=watch_events, recursive=recursive)
|
||||||
except Exception, err:
|
except Exception, err:
|
||||||
print "File system watcher failed: %s (on linux pyinotify not gevent compatible yet :( )" % err
|
print "File system watcher failed: %s (on linux pyinotify not gevent compatible yet :( )" % err
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue