Use virtualenv to run commit_queue script

R=pgervais@chromium.org
BUG=503067

Review URL: https://codereview.chromium.org/1195423002.

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@295843 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/commit_queue b/commit_queue
index db8b904..a634371 100755
--- a/commit_queue
+++ b/commit_queue
@@ -5,4 +5,8 @@
 
 base_dir=$(dirname "$0")
 
-PYTHONDONTWRITEBYTECODE=1 exec python "$base_dir/commit_queue.py" "$@"
+if [[ "#grep#fetch#cleanup#diff#" != *"#$1#"* ]]; then
+  "$base_dir"/update_depot_tools "$@"
+fi
+
+PYTHONDONTWRITEBYTECODE=1 exec "$base_dir/ENV/bin/python" "$base_dir/commit_queue.py" "$@"
diff --git a/commit_queue.bat b/commit_queue.bat
index 5f6baa3..76018a6 100755
--- a/commit_queue.bat
+++ b/commit_queue.bat
@@ -7,5 +7,8 @@
 :: This is required with cygwin only.

 PATH=%~dp0;%PATH%

 

+:: Synchronize the root directory before deferring control back to gclient.py.

+call "%~dp0\update_depot_tools.bat" %*

+

 :: Defer control.

-%~dp0python "%~dp0\commit_queue.py" %*

+%~dp0\ENV\bin\python "%~dp0\commit_queue.py" %*

diff --git a/third_party/cq_client/cq_pb2.py b/third_party/cq_client/cq_pb2.py
index ff53364..f317885 100644
--- a/third_party/cq_client/cq_pb2.py
+++ b/third_party/cq_client/cq_pb2.py
@@ -1,22 +1,13 @@
-# This file was originally generated by the protocol buffer compiler 2.6.1, but
-# was subsequently manually edited to import protobuf26 instead of
-# google.protobuf. If you need to re-generate this file, please make similar
-# changes again and add this comment back. More details on why we chose to
-# rename the package can be found in the file
-#   depot_tools/third_party/protobuf26/README.chromium
-# Example CL updating the references:
-#   https://codereview.chromium.org/1162993005/
-
 # Generated by the protocol buffer compiler.  DO NOT EDIT!
 # source: cq.proto
 
 import sys
 _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
-from protobuf26 import descriptor as _descriptor
-from protobuf26 import message as _message
-from protobuf26 import reflection as _reflection
-from protobuf26 import symbol_database as _symbol_database
-from protobuf26 import descriptor_pb2
+from google.protobuf import descriptor as _descriptor
+from google.protobuf import message as _message
+from google.protobuf import reflection as _reflection
+from google.protobuf import symbol_database as _symbol_database
+from google.protobuf import descriptor_pb2
 # @@protoc_insertion_point(imports)
 
 _sym_db = _symbol_database.Default()
diff --git a/third_party/cq_client/validate_config.py b/third_party/cq_client/validate_config.py
index 1e34b86..17d91db 100644
--- a/third_party/cq_client/validate_config.py
+++ b/third_party/cq_client/validate_config.py
@@ -6,11 +6,7 @@
 """CQ config validation library."""
 
 import argparse
-# The 'from google import protobuf' below was replaced to fix an issue where
-# some users may have built-in google package installed on their system, which
-# is incompatible with cq_pb2 below. This hack can be removed after
-# http://crbug.com/503067 is resolved.
-import protobuf26 as protobuf
+from google import protobuf
 import logging
 import re
 import sys