]> git.phdru.name Git - phdru.name/phdru.name.git/blob - make-changed.py
Fix(phd.py): Change URL for Lurk
[phdru.name/phdru.name.git] / make-changed.py
1 #! /usr/bin/env python
2
3 import sys, os
4
5 main_prog_mtime = os.path.getmtime("phd.py")
6 main_tmpl_mtime = os.path.getmtime("phd_site.tmpl")
7
8 for line in sys.stdin:
9    line = line.strip()
10    src_mtime = os.path.getmtime(line)
11
12    dest = line.replace(".tmpl", ".html")
13    try:
14       dest_mtime = os.path.getmtime(dest)
15    except OSError:
16       make = True
17    else:
18       make = (src_mtime > dest_mtime) or \
19          (main_prog_mtime > dest_mtime) or (main_tmpl_mtime > dest_mtime)
20
21    if make:
22       print line