210 for required_binary in REQUIRED_BINARIES:
211 if not shutil.which(required_binary):
212 return f'Required binary is not found on PATH: {required_binary}'
213
214 if '--verbose' in sys.argv:
215 logging.getLogger().setLevel(logging.INFO)
216
217 args = sys.argv[1:]
218 engine_override, recipes_cfg_path =
parse_args(args)
219
220 if recipes_cfg_path:
221
222 repo_root = os.path.dirname(
223 os.path.dirname(os.path.dirname(recipes_cfg_path)))
224 else:
225
226 repo_root = (
227 _git_output(['rev-parse', '--show-toplevel'],
228 cwd=os.path.abspath(os.path.dirname(__file__))).strip())
229 repo_root = os.path.abspath(repo_root).
decode()
230 recipes_cfg_path = os.path.join(repo_root, 'infra', 'config', 'recipes.cfg')
231 args = ['--package', recipes_cfg_path] + args
232 engine_path =
checkout_engine(engine_override, repo_root, recipes_cfg_path)
233
234 vpython = 'vpython3' + _BAT
235 if not shutil.which(vpython):
236 return f'Required binary is not found on PATH: {vpython}'
237
238
239
240
241 os.environ['PYTHONPATH'] = engine_path
242
243 spec = '.vpython3'
244 debugger = os.environ.get('RECIPE_DEBUGGER', '')
245 if debugger.startswith('pycharm'):
246 spec = '.pycharm.vpython3'
247 elif debugger.startswith('vscode'):
248 spec = '.vscode.vpython3'
249
250 argv = ([
251 vpython,
252 '-vpython-spec',
253 os.path.join(engine_path, spec),
254 '-u',
255 os.path.join(engine_path, 'recipe_engine', 'main.py'),
256 ] + args)
257
258 if IS_WIN:
259
260
261 import signal
262 signal.signal(signal.SIGBREAK, signal.SIG_IGN)
263 signal.signal(signal.SIGINT, signal.SIG_IGN)
264 signal.signal(signal.SIGTERM, signal.SIG_IGN)
265 return _subprocess_call(argv)
266
267 os.execvp(argv[0], argv)
268 return -1
269
270
static DecodeResult decode(std::string path)
static void parse_args(int argc, char *argv[], Args *args)