37 """Returns path to an existing program binary.
40 program: Basename of the program to find (e.g., 'render_pictures').
43 Absolute path to the program binary, as a string.
46 Exception: unable to find the program binary.
48 trunk_path = os.path.abspath(os.path.join(os.path.dirname(__file__),
50 possible_paths = [os.path.join(trunk_path,
'out',
'Release', program),
51 os.path.join(trunk_path,
'out',
'Debug', program),
52 os.path.join(trunk_path,
'out',
'Release',
54 os.path.join(trunk_path,
'out',
'Debug',
56 for try_path
in possible_paths:
57 if os.path.isfile(try_path):
59 raise Exception(
'cannot find %s in paths %s; maybe you need to '
60 'build %s?' % (program, possible_paths, program))