Make the queue module work with both Python 2 and Python 3.

The module is called "Queue" in Python 2, and "queue" in Python 3. Use the
same try-ImportError check that's already present in some other files in
depot_tools to make both download_from_google_storage and
upload_to_google_storage work.

Bug: 1007872, 1009819
Change-Id: I8177cd251cbaf8313f41708036c4f36aa6d8bfe2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1859994
Auto-Submit: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
This commit is contained in:
Raphael Kubo da Costa
2019-10-14 17:43:29 +00:00
committed by Commit Bot
parent 59b06a838a
commit 2b034d469f
3 changed files with 33 additions and 18 deletions

View File

@@ -10,7 +10,12 @@ from __future__ import print_function
import hashlib
import optparse
import os
import Queue
try:
import Queue as queue
except ImportError: # For Py3 compatibility
import queue
import re
import stat
import sys
@@ -142,11 +147,11 @@ def upload_to_google_storage(
# Start up all the worker threads plus the printer thread.
all_threads = []
ret_codes = Queue.Queue()
ret_codes = queue.Queue()
ret_codes.put((0, None))
upload_queue = Queue.Queue()
upload_queue = queue.Queue()
upload_timer = time.time()
stdout_queue = Queue.Queue()
stdout_queue = queue.Queue()
printer_thread = PrinterThread(stdout_queue)
printer_thread.daemon = True
printer_thread.start()