blob: 32c2fa0b2ce9283508a540e977699fdcb8a6b0b5 [file] [log] [blame]
[email protected]67bb8612013-11-08 20:51:401#!/usr/bin/env python
2# Copyright 2013 The Chromium Authors. All rights reserved.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6"""This script is a wrapper around the GN binary that is pulled from Google
7Cloud Storage when you sync Chrome. The binaries go into platform-specific
8subdirectories in the source tree.
9
10This script makes there be one place for forwarding to the correct platform's
11binary. It will also automatically try to find the gn binary when run inside
12the chrome source tree, so users can just type "gn" on the command line
13(normally depot_tools is on the path)."""
14
[email protected]3ac1c4e2014-01-16 02:44:4215import gclient_utils
[email protected]67bb8612013-11-08 20:51:4016import os
17import subprocess
18import sys
19
20
[email protected]67bb8612013-11-08 20:51:4021def main(args):
[email protected]cc968fe2014-06-23 17:30:3222 bin_path = gclient_utils.GetBuildtoolsPlatformBinaryPath()
23 if not bin_path:
24 print >> sys.stderr, ('gn.py: Could not find checkout in any parent of '
25 'the current path.\nThis must be run inside a '
26 'checkout.')
[email protected]f7facfa2014-09-05 12:40:2827 return 1
[email protected]cc968fe2014-06-23 17:30:3228 gn_path = os.path.join(bin_path, 'gn' + gclient_utils.GetExeSuffix())
[email protected]f7facfa2014-09-05 12:40:2829 if not os.path.exists(gn_path):
30 print >> sys.stderr, 'gn.py: Could not find gn executable at: %s' % gn_path
31 return 2
32 else:
[email protected]d05ab352014-12-05 17:24:2633 return subprocess.call([gn_path] + args[1:])
[email protected]67bb8612013-11-08 20:51:4034
[email protected]3ac1c4e2014-01-16 02:44:4235
[email protected]67bb8612013-11-08 20:51:4036if __name__ == '__main__':
[email protected]013731e2015-02-26 18:28:4337 try:
38 sys.exit(main(sys.argv))
39 except KeyboardInterrupt:
40 sys.stderr.write('interrupted\n')
41 sys.exit(1)