[Python-modules-commits] r2662 - in /packages/python-cherrypy/trunk/debian: changelog patches/00list patches/03_autoreloader_fix.dpatch

kitterma-guest at users.alioth.debian.org kitterma-guest at users.alioth.debian.org
Tue Jul 3 17:32:38 UTC 2007


Author: kitterma-guest
Date: Tue Jul  3 17:32:38 2007
New Revision: 2662

URL: http://svn.debian.org/wsvn/python-modules/?sc=1&rev=2662
Log:
Added patches/03_autoreloader_fix.dpatch.

Added:
    packages/python-cherrypy/trunk/debian/patches/00list
    packages/python-cherrypy/trunk/debian/patches/03_autoreloader_fix.dpatch
Modified:
    packages/python-cherrypy/trunk/debian/changelog

Modified: packages/python-cherrypy/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/python-modules/packages/python-cherrypy/trunk/debian/changelog?rev=2662&op=diff
==============================================================================
--- packages/python-cherrypy/trunk/debian/changelog (original)
+++ packages/python-cherrypy/trunk/debian/changelog Tue Jul  3 17:32:38 2007
@@ -10,7 +10,12 @@
   [ Loic Minier ]
   * Only track 2.x versions in watch file; thanks Goedson Teixeira Paixao.
 
- -- Loic Minier <lool at dooz.org>  Mon, 25 Jun 2007 13:12:38 +0200
+  [ Scott Kitterman ]
+  * debian/patches/03_autoreloader_fix.dpatch
+    - Fixed the auto-reloader if modules with an invalid __file__ attribute
+      are loaded, using code from CherryPy 3.
+
+ -- Scott Kitterman <scott at kitterman.com>  Tue, 03 Jul 2007 13:30:38 -0400
 
 python-cherrypy (2.2.1-3) unstable; urgency=low
 

Added: packages/python-cherrypy/trunk/debian/patches/00list
URL: http://svn.debian.org/wsvn/python-modules/packages/python-cherrypy/trunk/debian/patches/00list?rev=2662&op=file
==============================================================================
--- packages/python-cherrypy/trunk/debian/patches/00list (added)
+++ packages/python-cherrypy/trunk/debian/patches/00list Tue Jul  3 17:32:38 2007
@@ -1,0 +1,1 @@
+03_autoreloader_fix.dpatch

Added: packages/python-cherrypy/trunk/debian/patches/03_autoreloader_fix.dpatch
URL: http://svn.debian.org/wsvn/python-modules/packages/python-cherrypy/trunk/debian/patches/03_autoreloader_fix.dpatch?rev=2662&op=file
==============================================================================
--- packages/python-cherrypy/trunk/debian/patches/03_autoreloader_fix.dpatch (added)
+++ packages/python-cherrypy/trunk/debian/patches/03_autoreloader_fix.dpatch Tue Jul  3 17:32:38 2007
@@ -1,0 +1,41 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 03_autoreloader_fix.dpatch by John Millikin <jmillikin at gmail.com>
+##
+## 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
+
+ at 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():




More information about the Python-modules-commits mailing list