Revision: 7516
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7516&view=rev
Author:   mdboom
Date:     2009-08-21 18:35:47 +0000 (Fri, 21 Aug 2009)

Log Message:
-----------
Improve documentation re-build speed.

Modified Paths:
--------------
    trunk/matplotlib/doc/sphinxext/gen_gallery.py
    trunk/matplotlib/doc/sphinxext/gen_rst.py

Modified: trunk/matplotlib/doc/sphinxext/gen_gallery.py
===================================================================
--- trunk/matplotlib/doc/sphinxext/gen_gallery.py       2009-08-21 17:39:46 UTC 
(rev 7515)
+++ trunk/matplotlib/doc/sphinxext/gen_gallery.py       2009-08-21 18:35:47 UTC 
(rev 7516)
@@ -18,6 +18,10 @@
 
 multiimage = re.compile('(.*)_\d\d')
 
+def out_of_date(original, derived):
+    return (not os.path.exists(derived) or
+            os.stat(derived).st_mtime < os.stat(original).st_mtime)
+
 def gen_gallery(app, doctree):
     if app.builder.name != 'html':
         return
@@ -58,10 +62,10 @@
 
             # Create thumbnails based on images in tmpdir, and place
             # them within the build tree
-            image.thumbnail(
-                str(os.path.join(origdir, filename)),
-                str(os.path.join(thumbdir, filename)),
-                scale=0.3)
+            orig_path = str(os.path.join(origdir, filename))
+            thumb_path = str(os.path.join(thumbdir, filename))
+            if out_of_date(orig_path, thumb_path):
+                image.thumbnail(orig_path, thumb_path, scale=0.3)
 
             m = multiimage.match(basename)
             if m is None:

Modified: trunk/matplotlib/doc/sphinxext/gen_rst.py
===================================================================
--- trunk/matplotlib/doc/sphinxext/gen_rst.py   2009-08-21 17:39:46 UTC (rev 
7515)
+++ trunk/matplotlib/doc/sphinxext/gen_rst.py   2009-08-21 18:35:47 UTC (rev 
7516)
@@ -113,8 +113,7 @@
 
             fhsubdirIndex.write('    %s\n'%rstfile)
 
-            if (not out_of_date(fullpath, outputfile) and
-                not out_of_date(fullpath, outrstfile)):
+            if not out_of_date(fullpath, outrstfile):
                 continue
 
             fh = file(outrstfile, 'w')


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to