| OLD | NEW | 
|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python | 
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 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 """Helper script for GN to run an arbitrary binary. See compiled_action.gni. | 6 """Helper script for GN to run an arbitrary binary. See compiled_action.gni. | 
| 7 | 7 | 
| 8 Run with: | 8 Run with: | 
| 9   python gn_run_binary.py <invoker> <binary_name> [args ...] | 9   python gn_run_binary.py <invoker> <binary_name> [args ...] | 
| 10 | 10 | 
| (...skipping 30 matching lines...) Expand all  Loading... | 
| 41   # picking up system versions that might also be on the path. | 41   # picking up system versions that might also be on the path. | 
| 42   if os.path.isabs(argv[2]): | 42   if os.path.isabs(argv[2]): | 
| 43     path = argv[2] | 43     path = argv[2] | 
| 44   else: | 44   else: | 
| 45     path = './' + argv[2] | 45     path = './' + argv[2] | 
| 46 | 46 | 
| 47   if not os.path.isfile(path): | 47   if not os.path.isfile(path): | 
| 48     print "Binary not found: " + path | 48     print "Binary not found: " + path | 
| 49     return error_exit | 49     return error_exit | 
| 50 | 50 | 
| 51   # The rest of the arguements are passed directly to the executable. | 51   # The rest of the arguments are passed directly to the executable. | 
| 52   args = [path] + argv[3:] | 52   args = [path] + argv[3:] | 
| 53 | 53 | 
| 54   result = run_command(args) | 54   result = run_command(args) | 
| 55   if result != 0: | 55   if result != 0: | 
| 56     print result | 56     print result | 
| 57     return error_exit | 57     return error_exit | 
| 58   return 0 | 58   return 0 | 
| 59 | 59 | 
| 60 if __name__ == '__main__': | 60 if __name__ == '__main__': | 
| 61   sys.exit(main(sys.argv)) | 61   sys.exit(main(sys.argv)) | 
| OLD | NEW | 
|---|