Chromium Code Reviews| Index: scripts/slave/swarming/swarming_utils.py |
| diff --git a/scripts/slave/swarming/swarming_utils.py b/scripts/slave/swarming/swarming_utils.py |
| index b2368da4ed03970985bc63b7b9095d74d932a021..dacc95fb96a415029f61e3f233c587c7f46b0232 100644 |
| --- a/scripts/slave/swarming/swarming_utils.py |
| +++ b/scripts/slave/swarming/swarming_utils.py |
| @@ -6,6 +6,12 @@ |
| """Code to find swarming_client.""" |
| import os |
| +import sys |
| + |
| +from common import find_depot_tools # pylint: disable=W0611 |
| + |
| +# From depot_tools/ |
| +import subprocess2 |
| def find_client(base_dir): |
| @@ -24,3 +30,17 @@ def find_client(base_dir): |
| src_swarm_client = os.path.join(base_dir, 'src', 'tools', 'swarm_client') |
| if os.path.isdir(src_swarm_client): |
| return src_swarm_client |
| + |
| + |
| +def get_version(client): |
| + """Returns the version of swarming.py client tool, if available.""" |
| + try: |
| + version = subprocess2.check_output( |
| + [ |
| + sys.executable, |
| + os.path.join(client, 'swarming.py'), |
| + '--version', |
| + ]) |
| + except (subprocess2.CalledProcessError, OSError): |
| + return None |
| + 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
|