Home | History | Annotate | Download | only in resources
      1 #!/usr/bin/env python
      2 # Copyright 2015 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 """Calls the isolate Go executable in the checkout, failing if it cannot run.
      7 """
      8 
      9 # TODO(djd): make the caller invoke the Go binary directly, kill this script.
     10 
     11 import os
     12 import subprocess
     13 import sys
     14 
     15 
     16 def try_go(path, args):
     17   """Tries to run the Go implementation of isolate.
     18   """
     19   luci_go = os.path.join(os.path.dirname(path), 'luci-go')
     20   if sys.platform == 'win32':
     21     exe = os.path.join(luci_go, 'win64', 'isolate.exe')
     22   elif sys.platform == 'darwin':
     23     exe = os.path.join(luci_go, 'mac64', 'isolate')
     24   else:
     25     exe = os.path.join(luci_go, 'linux64', 'isolate')
     26 
     27   return subprocess.call([exe] + args)
     28 
     29 
     30 def main():
     31   path = sys.argv[1]
     32   args = sys.argv[2:]
     33   return try_go(path, args)
     34 
     35 
     36 if __name__ == '__main__':
     37   sys.exit(main())
     38