Suggested by djb in personal email, and on the mailing list. redo-targets lists all the targets in the database; redo-sources lists all the existing sources (ie. files that are referred to but which aren't targets). redo-ifcreate filenames aren't included in the redo-sources list.
29 lines
605 B
Python
29 lines
605 B
Python
import os, errno, fcntl
|
|
from atoi import atoi
|
|
|
|
|
|
def join(between, l):
|
|
return between.join(l)
|
|
|
|
|
|
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
|
|
|
|
|
|
def close_on_exec(fd, yes):
|
|
fl = fcntl.fcntl(fd, fcntl.F_GETFD)
|
|
fl &= ~fcntl.FD_CLOEXEC
|
|
if yes:
|
|
fl |= fcntl.FD_CLOEXEC
|
|
fcntl.fcntl(fd, fcntl.F_SETFD, fl)
|
|
|
|
|