Chromium Code Reviews| Index: scripts/slave/recipe_modules/isolate/resources/isolate.py |
| diff --git a/scripts/slave/recipe_modules/isolate/resources/isolate.py b/scripts/slave/recipe_modules/isolate/resources/isolate.py |
| index 2d888ece97928047b758eede91deec2091e80104..9414df518da13bc0f0e02829e96679ba1c13e823 100755 |
| --- a/scripts/slave/recipe_modules/isolate/resources/isolate.py |
| +++ b/scripts/slave/recipe_modules/isolate/resources/isolate.py |
| @@ -3,9 +3,11 @@ |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| -"""Calls either isolate.py or isolate Go executable in the checkout. |
| +"""Calls the isolate Go executable in the checkout, failing if it cannot run. |
| """ |
| +# TODO(djd): make the caller invoke the Go binary directly, kill this script. |
| + |
| import os |
| import subprocess |
| import sys |
| @@ -13,8 +15,6 @@ import sys |
| def try_go(path, args): |
| """Tries to run the Go implementation of isolate. |
| - |
| - Returns None if it should fall back to the python implementation. |
| """ |
| luci_go = os.path.join(os.path.dirname(path), 'luci-go') |
| if sys.platform == 'win32': |
| @@ -23,28 +23,6 @@ def try_go(path, args): |
| exe = os.path.join(luci_go, 'mac64', 'isolate') |
| else: |
| exe = os.path.join(luci_go, 'linux64', 'isolate') |
| - if not os.access(exe, os.X_OK): |
| - return None |
| - |
| - # Try to use Go implementation. |
| - try: |
| - version = subprocess.check_output([exe, 'version']).strip() |
| - version = tuple(map(int, version.split('.'))) |
| - except (subprocess.CalledProcessError, OSError, ValueError): |
| - return None |
| - |
| - expected = (0, 2, 2) |
| - |
| - # Enlarge both tuples so (1, 0) == (1, 0, 0). |
| - while len(version) < len(expected): |
| - version = tuple(list(version) + [0]) |
| - while len(expected) < len(version): |
| - version = tuple(list(expected) + [0]) |
| - |
| - # Key behavior based on version if necessary. |
| - if version < expected: |
| - print('Expected %s, found %s' % '.'.join(expected), '.'.join(version)) |
| - return None |
| return subprocess.call([exe] + args) |
|
mithro
2016/11/02 07:13:11
Maybe you want to use subprocess.check_call ?
|
| @@ -52,11 +30,7 @@ def try_go(path, args): |
| def main(): |
| path = sys.argv[1] |
| args = sys.argv[2:] |
| - ret = try_go(path, args) |
| - if ret is None: |
| - return subprocess.call( |
| - [sys.executable, os.path.join(path, 'isolate.py')] + args) |
| - return ret |
| + return try_go(path, args) |
| if __name__ == '__main__': |