@@ -436,16 +436,19 @@ def out_of_date(original, derived, includes=None):
436436 *derived* and *original* are full paths, and *includes* is optionally a
437437 list of full paths which may have been included in the *original*.
438438 """
439+ if not os .path .exists (derived ):
440+ return True
441+
439442 if includes is None :
440443 includes = []
441444 files_to_check = [original , * includes ]
442445
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 )
447449
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 )
449452
450453
451454class PlotError (RuntimeError ):
@@ -763,9 +766,9 @@ def run(arguments, content, options, state_machine, state, lineno):
763766 except AttributeError :
764767 # the document.include_log attribute only exists in docutils >=0.17,
765768 # 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
769772 if os .path .isfile (f )]
770773 # remove the source file itself from the includes
771774 try :
0 commit comments