@@ -436,16 +436,19 @@ def out_of_date(original, derived, includes=None):
436
436
*derived* and *original* are full paths, and *includes* is optionally a
437
437
list of full paths which may have been included in the *original*.
438
438
"""
439
+ if not os .path .exists (derived ):
440
+ return True
441
+
439
442
if includes is None :
440
443
includes = []
441
444
files_to_check = [original , * includes ]
442
445
443
- def out_of_date_one (original , derived ):
444
- return (not os .path .exists (derived ) or
445
- (os .path .exists (original ) and
446
- os .stat (derived ).st_mtime < os .stat (original ).st_mtime ))
446
+ def out_of_date_one (original , derived_mtime ):
447
+ return (os .path .exists (original ) and
448
+ derived_mtime < os .stat (original ).st_mtime )
447
449
448
- return any (out_of_date_one (f , derived ) for f in files_to_check )
450
+ derived_mtime = os .stat (derived ).st_mtime
451
+ return any (out_of_date_one (f , derived_mtime ) for f in files_to_check )
449
452
450
453
451
454
class PlotError (RuntimeError ):
@@ -763,9 +766,9 @@ def run(arguments, content, options, state_machine, state, lineno):
763
766
except AttributeError :
764
767
# the document.include_log attribute only exists in docutils >=0.17,
765
768
# before that we need to inspect the state machine
766
- possible_sources = [ os .path .join (setup .confdir , t [0 ])
767
- for t in state_machine .input_lines .items ]
768
- source_file_includes = [f for f in set ( possible_sources )
769
+ possible_sources = { os .path .join (setup .confdir , t [0 ])
770
+ for t in state_machine .input_lines .items }
771
+ source_file_includes = [f for f in possible_sources
769
772
if os .path .isfile (f )]
770
773
# remove the source file itself from the includes
771
774
try :
0 commit comments