Просмотр исходного кода

gclient: Execute python hooks using vpython.

Change-Id: I032c838c07ca8b715976bd9dc428c1bd6a77d80b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1793009
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Edward Lemur 5 лет назад
Родитель
Сommit
6f18e68719
2 измененных файлов с 3 добавлено и 9 удалено
  1. 1 6
      gclient.py
  2. 2 3
      tests/gclient_smoketest.py

+ 1 - 6
gclient.py

@@ -242,12 +242,7 @@ class Hook(object):
     cmd = [arg for arg in self._action]
 
     if cmd[0] == 'python':
-      # If the hook specified "python" as the first item, the action is a
-      # Python script. Run it by starting a new copy of the same interpreter if
-      # we're running on Python 2.
-      # When using vpython3, "python" refers to the Python 3 executable used by
-      # vpython3, so use "vpython" instead.
-      cmd[0] = sys.executable if six.PY2 else 'vpython'
+      cmd[0] = 'vpython'
     if cmd[0] == 'vpython' and _detect_host_os() == 'win':
       cmd[0] += '.bat'
 

+ 2 - 3
tests/gclient_smoketest.py

@@ -734,10 +734,9 @@ class GClientSmokeGIT(GClientSmokeBase):
         ('running', self.root_dir),                 # pre-deps hook
         ('running', self.root_dir),                 # pre-deps hook (fails)
     ]
-    executable = sys.executable if sys.version_info.major == 2 else 'vpython'
-    expected_stderr = ("Error: Command '%s -c import sys; "
+    expected_stderr = ("Error: Command 'vpython -c import sys; "
                        "sys.exit(1)' returned non-zero exit status 1 in %s\n"
-                       % (executable, self.root_dir))
+                       % self.root_dir)
     stdout, stderr, retcode = self.gclient(['sync', '--deps', 'mac', '--jobs=1',
                                             '--revision',
                                             'src@' + self.githash('repo_5', 3)])