apenwarr-redo/redo-ifcreate.py
Avery Pennarun 5417d0165a redo-ifcreate: barf if the file already exists.
I'm pretty sure this must be the intended behaviour.  It's kind of
meaningless to use this to declare a dependency on a file that might start
to exist later, if the file already exists.
2010-11-13 01:22:11 -08:00

17 lines
385 B
Python
Executable file

#!/usr/bin/python
import sys, os
import vars
from helpers import *
if not vars.TARGET:
err('redo-ifcreate: error: must be run from inside a .do\n')
sys.exit(100)
for t in sys.argv[1:]:
mkdirp('%s/.redo' % vars.BASE)
if os.path.exists(t):
err('redo-ifcreate: error: %r already exists\n' % t)
sys.exit(1)
else:
add_dep(vars.TARGET, 'c', t)