diff -u python-cherrypy-2.2.1/debian/changelog python-cherrypy-2.2.1/debian/changelog --- python-cherrypy-2.2.1/debian/changelog +++ python-cherrypy-2.2.1/debian/changelog @@ -1,3 +1,11 @@ +python-cherrypy (2.2.1-3ubuntu1) feisty; urgency=low + + * debian/patches/03_autoreloader_fix.dpatch + - Fixed the auto-reloader if modules with an invalid __file__ attribute + are loaded, using code from CherryPy 3 + + -- John Millikin Wed, 14 Feb 2007 20:40:33 -0800 + python-cherrypy (2.2.1-3) unstable; urgency=low * debian/rules, debian/control: only in patch2: unchanged: --- python-cherrypy-2.2.1.orig/debian/patches/00list +++ python-cherrypy-2.2.1/debian/patches/00list @@ -0,0 +1 @@ +03_autoreloader_fix.dpatch only in patch2: unchanged: --- python-cherrypy-2.2.1.orig/debian/patches/03_autoreloader_fix.dpatch +++ python-cherrypy-2.2.1/debian/patches/03_autoreloader_fix.dpatch @@ -0,0 +1,41 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 03_autoreloader_fix.dpatch by John Millikin +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Fixed the auto-reloader if modules with an invalid __file__ attribute +## DP: are loaded, using code from CherryPy 3 + +@DPATCH@ + +--- cherrypy/lib/autoreload.py~ 2007-02-14 17:17:37.553928785 -0800 ++++ cherrypy/lib/autoreload.py 2007-02-14 17:20:47.615142289 -0800 +@@ -23,15 +23,25 @@ def reloader_thread(freq): + if filename: + if filename.endswith(".pyc"): + filename = filename[:-1] ++ ++ oldtime = mtimes.get(filename, 0) ++ if oldtime is None: ++ # Module with no .py file. Skip it. ++ continue ++ + try: + mtime = os.stat(filename).st_mtime + except OSError: +- sys.exit(3) # force reload ++ # Either a module with no .py file, or it's been deleted. ++ mtime = None ++ + if filename not in mtimes: ++ # If a module has no .py file, this will be None. + mtimes[filename] = mtime +- continue +- if mtime > mtimes[filename]: +- sys.exit(3) # force reload ++ else: ++ if mtime is None or mtime > oldtime: ++ # The file has been deleted or modified. ++ sys.exit(3) + time.sleep(freq) + + def restart_with_reloader():