apenwarr-redo/redo-ifcreate.py
Avery Pennarun 132ff02840 Only mkdirp() the .redo directory in one place right at the beginning.
This doesn't really seem to change anything, but it's more correct and
should reveal weirdness (especially an incorrect .redo directory in a
sub-redo) sooner.
2010-11-19 03:16:39 -08:00

19 lines
446 B
Python
Executable file

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