File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818
1919multiimage = re .compile ('(.*)_\d\d' )
2020
21+ def out_of_date (original , derived ):
22+ return (not os .path .exists (derived ) or
23+ os .stat (derived ).st_mtime < os .stat (original ).st_mtime )
24+
2125def gen_gallery (app , doctree ):
2226 if app .builder .name != 'html' :
2327 return
@@ -58,10 +62,10 @@ def gen_gallery(app, doctree):
5862
5963 # Create thumbnails based on images in tmpdir, and place
6064 # them within the build tree
61- image . thumbnail (
62- str (os .path .join (origdir , filename )),
63- str ( os . path . join ( thumbdir , filename )),
64- scale = 0.3 )
65+ orig_path = str ( os . path . join ( origdir , filename ))
66+ thumb_path = str (os .path .join (thumbdir , filename ))
67+ if out_of_date ( orig_path , thumb_path ):
68+ image . thumbnail ( orig_path , thumb_path , scale = 0.3 )
6569
6670 m = multiimage .match (basename )
6771 if m is None :
Original file line number Diff line number Diff line change @@ -113,8 +113,7 @@ def generate_example_rst(app):
113113
114114 fhsubdirIndex .write (' %s\n ' % rstfile )
115115
116- if (not out_of_date (fullpath , outputfile ) and
117- not out_of_date (fullpath , outrstfile )):
116+ if not out_of_date (fullpath , outrstfile ):
118117 continue
119118
120119 fh = file (outrstfile , 'w' )
You can’t perform that action at this time.
0 commit comments