OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """This script is a wrapper around the GN binary that is pulled from Google | 6 """This script is a wrapper around the GN binary that is pulled from Google |
7 Cloud Storage when you sync Chrome. The binaries go into platform-specific | 7 Cloud Storage when you sync Chrome. The binaries go into platform-specific |
8 subdirectories in the source tree. | 8 subdirectories in the source tree. |
9 | 9 |
10 This script makes there be one place for forwarding to the correct platform's | 10 This script makes there be one place for forwarding to the correct platform's |
(...skipping 25 matching lines...) Expand all Loading... |
36 return cur | 36 return cur |
37 up_one = os.path.dirname(cur) | 37 up_one = os.path.dirname(cur) |
38 if up_one == cur: | 38 if up_one == cur: |
39 return None # Reached the top of the directory tree | 39 return None # Reached the top of the directory tree |
40 cur = up_one | 40 cur = up_one |
41 | 41 |
42 | 42 |
43 def RunGN(sourceroot): | 43 def RunGN(sourceroot): |
44 # The binaries in platform-specific subdirectories in src/tools/gn/bin. | 44 # The binaries in platform-specific subdirectories in src/tools/gn/bin. |
45 gnpath = sourceroot + '/tools/gn/bin/' | 45 gnpath = sourceroot + '/tools/gn/bin/' |
46 if sys.platform == 'win32': | 46 if sys.platform in ('cygwin', 'win32'): |
47 gnpath += 'win/gn.exe' | 47 gnpath += 'win/gn.exe' |
48 elif sys.platform.startswith('linux'): | 48 elif sys.platform.startswith('linux'): |
49 gnpath += 'linux/gn' | 49 gnpath += 'linux/gn' |
50 elif sys.platform == 'darwin': | 50 elif sys.platform == 'darwin': |
51 gnpath += 'mac/gn' | 51 gnpath += 'mac/gn' |
52 else: | 52 else: |
53 raise PlatformUnknownError('Unknown platform for GN: ' + sys.platform) | 53 raise PlatformUnknownError('Unknown platform for GN: ' + sys.platform) |
54 | 54 |
55 return subprocess.call([gnpath] + sys.argv[1:]) | 55 return subprocess.call([gnpath] + sys.argv[1:]) |
56 | 56 |
57 | 57 |
58 def main(args): | 58 def main(args): |
59 sourceroot = FindSourceRootOnPath() | 59 sourceroot = FindSourceRootOnPath() |
60 if not sourceroot: | 60 if not sourceroot: |
61 print >> sys.stderr, '.gn file not found in any parent of the current path.' | 61 print >> sys.stderr, '.gn file not found in any parent of the current path.' |
62 sys.exit(1) | 62 sys.exit(1) |
63 return RunGN(sourceroot) | 63 return RunGN(sourceroot) |
64 | 64 |
65 if __name__ == '__main__': | 65 if __name__ == '__main__': |
66 sys.exit(main(sys.argv)) | 66 sys.exit(main(sys.argv)) |
OLD | NEW |