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

Unified Diff: tools/isolate/run_test_from_archive.py

Issue 10449089: Copy fix_python_path() in more standalone files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « testing/test_env.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/isolate/run_test_from_archive.py
diff --git a/tools/isolate/run_test_from_archive.py b/tools/isolate/run_test_from_archive.py
index 1b0f0d13a7592f927a8d2c358eb2dc9e0bee9623..735b3bda36c3d8f1cf63bb192735e448125a673e 100755
--- a/tools/isolate/run_test_from_archive.py
+++ b/tools/isolate/run_test_from_archive.py
@@ -136,6 +136,16 @@ def get_free_space(path):
return f.f_bfree * f.f_frsize
+def fix_python_path(cmd):
+ """Returns the fixed command line to call the right python executable."""
+ out = cmd[:]
+ if out[0] == 'python':
+ out[0] = sys.executable
+ elif out[0].endswith('.py'):
+ out.insert(0, sys.executable)
+ return out
+
+
class Cache(object):
"""Stateful LRU cache.
@@ -267,6 +277,7 @@ def run_tha_test(manifest, cache_dir, remote, max_cache_size, min_free_space):
cmd = manifest['command']
# Ensure paths are correctly separated on windows.
cmd[0] = cmd[0].replace('/', os.path.sep)
+ cmd = fix_python_path(cmd)
logging.info('Running %s, cwd=%s' % (cmd, cwd))
try:
return subprocess.call(cmd, cwd=cwd)
« no previous file with comments | « testing/test_env.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698