Return whether *derived* is out-of-date relative to *original* or any of the RST files included in it using the RST include directive (*includes*). *derived* and *original* are full paths, and *includes* is optionally a list of full paths which may have been included in the *origina
(original, derived, includes=None)
| 524 | |
| 525 | |
| 526 | def out_of_date(original, derived, includes=None): |
| 527 | """ |
| 528 | Return whether *derived* is out-of-date relative to *original* or any of |
| 529 | the RST files included in it using the RST include directive (*includes*). |
| 530 | *derived* and *original* are full paths, and *includes* is optionally a |
| 531 | list of full paths which may have been included in the *original*. |
| 532 | """ |
| 533 | if not os.path.exists(derived): |
| 534 | return True |
| 535 | |
| 536 | if includes is None: |
| 537 | includes = [] |
| 538 | files_to_check = [original, *includes] |
| 539 | |
| 540 | def out_of_date_one(original, derived_mtime): |
| 541 | return (os.path.exists(original) and |
| 542 | derived_mtime < os.stat(original).st_mtime) |
| 543 | |
| 544 | derived_mtime = os.stat(derived).st_mtime |
| 545 | return any(out_of_date_one(f, derived_mtime) for f in files_to_check) |
| 546 | |
| 547 | |
| 548 | class PlotError(RuntimeError): |
no test coverage detected
searching dependent graphs…