Ticket #9602: 9602.fix-autoreload-for-bad-plugins.2.diff
| File 9602.fix-autoreload-for-bad-plugins.2.diff, 1.9 KB (added by anatoly techtonik <techtonik@…>, 17 months ago) |
|---|
-
trac/loader.py
22 22 import os 23 23 import sys 24 24 25 from trac.util.autoreload import _AUTORELOAD_EXTRA_FILES 25 26 from trac.util.compat import set 26 27 from trac.util.text import exception_to_unicode 27 28 … … 95 96 env.log.error('Failed to load plugin from %s: %s', 96 97 plugin_file, 97 98 exception_to_unicode(e, traceback=True)) 99 # add failed plugin to the list of monitored files 100 # in autoreload mode for development 101 if plugin_file not in _AUTORELOAD_EXTRA_FILES: 102 _AUTORELOAD_EXTRA_FILES.append(plugin_file) 98 103 99 104 return _load_py_files 100 105 -
trac/util/autoreload.py
15 15 import sys 16 16 import thread 17 17 import time 18 import itertools 18 19 19 20 _SLEEP_TIME = 1 21 _AUTORELOAD_EXTRA_FILES = [] 20 22 21 23 def _reloader_thread(modification_callback): 22 24 """When this function is run from the main thread, it will force other … … 27 29 """ 28 30 mtimes = {} 29 31 while True: 30 for filename in filter(None, [getattr(module, '__file__', None) 31 for module in sys.modules.values()]): 32 for filename in itertools.chain( 33 filter(None, [getattr(module, '__file__', None) 34 for module in sys.modules.values()]), 35 _AUTORELOAD_EXTRA_FILES 36 ): 32 37 while not os.path.isfile(filename): # Probably in an egg or zip file 33 38 filename = os.path.dirname(filename) 34 39 if not filename:
