#NEWLINE# def spawn_watcher( app ) : #NEWLINE# #INDENT# global NOTIFIER #NEWLINE# watched_dirs = [ ] #NEWLINE# watched_files = [ ] #NEWLINE# wm = pyinotify . WatchManager ( ) #NEWLINE# watched_files = [ ] #NEWLINE# for plugin_dir in app . _meta . plugin_config_dirs : #NEWLINE# #INDENT# plugin_dir = fs . abspath ( plugin_dir ) #NEWLINE# if ( not os . path . exists ( plugin_dir ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# if ( plugin_dir not in watched_dirs ) : #NEWLINE# #INDENT# watched_dirs . append ( watched_files ) #NEWLINE# #UNINDENT# res = os . walk ( plugin_dir ) #NEWLINE# for ( path , dirs , files ) in os . walk ( plugin_dir ) : #NEWLINE# #INDENT# plugin_config_files = files #NEWLINE# break #NEWLINE# #UNINDENT# for plugin_config in plugin_config_files : #NEWLINE# #INDENT# full_plugin_path = os . path . join ( plugin_dir , plugin_config ) #NEWLINE# if ( full_plugin_path not in watched_files ) : #NEWLINE# #INDENT# watched_files . append ( full_plugin_path ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# for path in app . _meta . config_files : #NEWLINE# #INDENT# if os . path . exists ( path ) : #NEWLINE# #INDENT# if ( path not in watched_files ) : #NEWLINE# #INDENT# watched_files . append ( path ) #NEWLINE# #UNINDENT# this_dir = os . path . dirname ( path ) #NEWLINE# if ( this_dir not in watched_dirs ) : #NEWLINE# #INDENT# watched_dirs . append ( this_dir ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# for path in watched_dirs : #NEWLINE# #INDENT# wm . add_watch ( path , MASK , rec = True ) #NEWLINE# #UNINDENT# eh = ConfigEventHandler ( app , watched_files ) #NEWLINE# NOTIFIER = pyinotify . ThreadedNotifier ( wm , eh ) #NEWLINE# NOTIFIER . start ( )