Now that the python scripts are all in a "redo" python module, we can use the "new style" (ahem) package-relative imports. This appeases pylint, plus avoids confusion in case more than one package has similarly-named modules.
31 lines
792 B
Python
31 lines
792 B
Python
import sys, os
|
|
from . import env, paths
|
|
from .logs import err
|
|
|
|
|
|
def main():
|
|
env.init_no_state()
|
|
if len(sys.argv[1:]) != 1:
|
|
err('%s: exactly one argument expected.\n' % sys.argv[0])
|
|
sys.exit(1)
|
|
|
|
want = sys.argv[1]
|
|
if not want:
|
|
err('cannot build the empty target ("").\n')
|
|
sys.exit(204)
|
|
|
|
abswant = os.path.abspath(want)
|
|
pdf = paths.possible_do_files(abswant)
|
|
for dodir, dofile, basedir, basename, ext in pdf:
|
|
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
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|