Extremely basic first crack at implementing djb's redo.
And a test program.
This commit is contained in:
commit
a51764c907
13 changed files with 305 additions and 0 deletions
22
helpers.py
Normal file
22
helpers.py
Normal 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
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue