#! /usr/bin/env python3 import sys, os main_prog_mtime = os.path.getmtime("phd.py") main_tmpl_mtime = os.path.getmtime("phd_site.tmpl") for line in sys.stdin: line = line.strip() src_mtime = os.path.getmtime(line) dest = line.replace(".tmpl", ".html") try: dest_mtime = os.path.getmtime(dest) except OSError: make = True else: make = (src_mtime > dest_mtime) or \ (main_prog_mtime > dest_mtime) or (main_tmpl_mtime > dest_mtime) if make: print(line)