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

Side by Side Diff: scripts/slave/swarming/swarming_utils.py

Issue 22909021: Add build slave side support for the new swarming.py script. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: tested to work Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
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 """Code to find swarming_client.""" 6 """Code to find swarming_client."""
7 7
8 import os 8 import os
9 import sys
10
11 from common import find_depot_tools # pylint: disable=W0611
12
13 # From depot_tools/
14 import subprocess2
9 15
10 16
11 def find_client(base_dir): 17 def find_client(base_dir):
12 """Returns the path to swarming_client if found. 18 """Returns the path to swarming_client if found.
13 19
14 |base_dir| will be in general os.getcwd(), so the script is very dependent on 20 |base_dir| will be in general os.getcwd(), so the script is very dependent on
15 CWD. CWD should be the base directory of the checkout. It has always been the 21 CWD. CWD should be the base directory of the checkout. It has always been the
16 case. 22 case.
17 """ 23 """
18 src_swarming_client = os.path.join( 24 src_swarming_client = os.path.join(
19 base_dir, 'src', 'tools', 'swarming_client') 25 base_dir, 'src', 'tools', 'swarming_client')
20 if os.path.isdir(src_swarming_client): 26 if os.path.isdir(src_swarming_client):
21 return src_swarming_client 27 return src_swarming_client
22 28
23 # This is the previous path. This can be removed around 2013-12-01. 29 # This is the previous path. This can be removed around 2013-12-01.
24 src_swarm_client = os.path.join(base_dir, 'src', 'tools', 'swarm_client') 30 src_swarm_client = os.path.join(base_dir, 'src', 'tools', 'swarm_client')
25 if os.path.isdir(src_swarm_client): 31 if os.path.isdir(src_swarm_client):
26 return src_swarm_client 32 return src_swarm_client
33
34
35 def get_version(client):
36 """Returns the version of swarming.py client tool, if available."""
37 try:
38 version = subprocess2.check_output(
39 [
40 sys.executable,
41 os.path.join(client, 'swarming.py'),
42 '--version',
43 ])
44 except (subprocess2.CalledProcessError, OSError):
45 return None
46 return map(int, version.split('.'))
Isaac (away) 2013/08/27 01:35:20 This returns a generator -- convert to a list?
M-A Ruel 2013/08/27 12:23:37 http://docs.python.org/2/library/functions.html#ma
Isaac (use chromium) 2013/08/27 17:43:00 Hmm, I must be remembering correctly. Weird. I u
OLDNEW
« no previous file with comments | « scripts/slave/swarming/get_swarm_results_shim.py ('k') | scripts/slave/swarming/trigger_swarm_shim.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698