Revision: 7765
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7765&view=rev
Author: mdboom
Date: 2009-09-15 20:04:22 +0000 (Tue, 15 Sep 2009)
Log Message:
-----------
Fix multiprocessing of gallery. Change how gallery.html is generated to
prevent a full rebuild.
Modified Paths:
--------------
trunk/matplotlib/doc/sphinxext/gen_gallery.py
Modified: trunk/matplotlib/doc/sphinxext/gen_gallery.py
===================================================================
--- trunk/matplotlib/doc/sphinxext/gen_gallery.py 2009-09-15 19:28:09 UTC
(rev 7764)
+++ trunk/matplotlib/doc/sphinxext/gen_gallery.py 2009-09-15 20:04:22 UTC
(rev 7765)
@@ -18,6 +18,9 @@
multiimage = re.compile('(.*)_\d\d')
+def make_thumbnail(args):
+ image.thumbnail(args[0], args[1], 0.3)
+
def out_of_date(original, derived):
return (not os.path.exists(derived) or
os.stat(derived).st_mtime < os.stat(original).st_mtime)
@@ -87,16 +90,23 @@
link = 'examples/%s/%s.html'%(subdir, basename)
rows.append(link_template%(link, thumbfile, basename))
- fh = file(os.path.join(app.builder.srcdir, '_templates', 'gallery.html'),
- 'w')
- fh.write(template%'\n'.join(rows))
- fh.close()
+ # Only write out the file if the contents have actually changed.
+ # Otherwise, this triggers a full rebuild of the docs
+ content = template%'\n'.join(rows)
+ gallery_path = os.path.join(app.builder.srcdir, '_templates',
'gallery.html')
+ if os.path.exists(gallery_path):
+ fh = file(gallery_path, 'r')
+ regenerate = fh.read() != content
+ fh.close()
+ else:
+ regenerate = True
+ if regenerate:
+ fh = file(gallery_path, 'w')
+ fh.write(content)
+ fh.close()
try:
import multiprocessing
- def make_thumbnail(args):
- image.thumbnail(args[0], args[1], 0.3)
-
app.builder.info("generating thumbnails... ", nonl=True)
pool = multiprocessing.Pool()
pool.map(make_thumbnail, thumbnails.iteritems())
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins