Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(546)

Side by Side Diff: tools/isolate_driver.py

Issue 1378133005: [swarming] Add isolate driver. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Review Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/isolate.gypi ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright 2015 the V8 project 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 """Adaptor script called through build/isolate.gypi.
7
8 Slimmed down version of chromium's isolate driver that doesn't process dynamic
9 dependencies.
10 """
11
12 import json
13 import logging
14 import os
15 import subprocess
16 import sys
17
18 TOOLS_DIR = os.path.dirname(os.path.abspath(__file__))
19
20
21 def prepare_isolate_call(args, output):
22 """Gathers all information required to run isolate.py later.
23
24 Dumps it as JSON to |output| file.
25 """
26 with open(output, 'wb') as f:
27 json.dump({
28 'args': args,
29 'dir': os.getcwd(),
30 'version': 1,
31 }, f, indent=2, sort_keys=True)
32
33
34 def main():
35 logging.basicConfig(level=logging.ERROR, format='%(levelname)7s %(message)s')
36 if len(sys.argv) < 2:
37 print >> sys.stderr, 'Internal failure; mode required'
38 return 1
39 mode = sys.argv[1]
40 args = sys.argv[1:]
41 isolate = None
42 isolated = None
43 for i, arg in enumerate(args):
44 if arg == '--isolate':
45 isolate = i + 1
46 if arg == '--isolated':
47 isolated = i + 1
48 if not isolate or not isolated:
49 print >> sys.stderr, 'Internal failure'
50 return 1
51
52 # In 'prepare' mode just collect all required information for postponed
53 # isolated.py invocation later, store it in *.isolated.gen.json file.
54 if mode == 'prepare':
55 prepare_isolate_call(args[1:], args[isolated] + '.gen.json')
56 return 0
57
58 swarming_client = os.path.join(TOOLS_DIR, 'swarming_client')
59 sys.stdout.flush()
60 return subprocess.call(
61 [sys.executable, os.path.join(swarming_client, 'isolate.py')] + args)
62
63
64 if __name__ == '__main__':
65 sys.exit(main())
OLDNEW
« no previous file with comments | « build/isolate.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698