Improved autoreloader to ignore files that might be in eggs. Refs #596

git-svn-id: http://code.djangoproject.com/svn/django/trunk@1010 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2005-10-25 02:01:10 +00:00
parent 5c3d1ec163
commit 3ad82eff77
1 changed files with 2 additions and 0 deletions

View File

@ -37,6 +37,8 @@ def reloader_thread():
mtimes = {} mtimes = {}
while RUN_RELOADER: while RUN_RELOADER:
for filename in filter(lambda v: v, map(lambda m: getattr(m, "__file__", None), sys.modules.values())) + reloadFiles: for filename in filter(lambda v: v, map(lambda m: getattr(m, "__file__", None), sys.modules.values())) + reloadFiles:
if not os.path.exists(filename):
continue # File might be in an egg, so it can't be reloaded.
if filename.endswith(".pyc"): if filename.endswith(".pyc"):
filename = filename[:-1] filename = filename[:-1]
mtime = os.stat(filename).st_mtime mtime = os.stat(filename).st_mtime