Extremely basic first crack at implementing djb's redo.

And a test program.
This commit is contained in:
Avery Pennarun 2010-11-12 05:24:46 -08:00
commit a51764c907
13 changed files with 305 additions and 0 deletions

22
helpers.py Normal file
View file

@ -0,0 +1,22 @@
import sys, os, errno
def log(s):
sys.stdout.flush()
sys.stderr.write(s)
sys.stderr.flush()
def unlink(f):
"""Delete a file at path 'f' if it currently exists.
Unlike os.unlink(), does not throw an exception if the file didn't already
exist.
"""
try:
os.unlink(f)
except OSError, e:
if e.errno == errno.ENOENT:
pass # it doesn't exist, that's what you asked for