The new format is just a list of .do files we tried, with a newline after each one. If we successfully found a .do file, we exit 0, else we exit 1. As discussed on the redo-list mailing list, it's easier to parse without the extra cruft. This makes users figure out $1 and $2 themselves, but that's not very hard, and maybe for the best.
24 lines
599 B
Python
Executable file
24 lines
599 B
Python
Executable file
#!/usr/bin/env python
|
|
import sys, os
|
|
|
|
import vars_init
|
|
vars_init.init([])
|
|
|
|
import builder
|
|
from log import err
|
|
|
|
if len(sys.argv[1:]) != 1:
|
|
err('%s: exactly one argument expected.\n' % sys.argv[0])
|
|
sys.exit(1)
|
|
|
|
want = sys.argv[1]
|
|
abswant = os.path.abspath(want)
|
|
for dodir,dofile,basedir,basename,ext in builder.possible_do_files(abswant):
|
|
dopath = os.path.join('/', dodir, dofile)
|
|
relpath = os.path.relpath(dopath, '.')
|
|
exists = os.path.exists(dopath)
|
|
assert('\n' not in relpath)
|
|
print relpath
|
|
if exists:
|
|
sys.exit(0)
|
|
sys.exit(1) # no appropriate dofile found
|