Use print() instead of print in rtc_tools/ python scripts.

Bug: None
Change-Id: I065f8363583b0934b0b0e3d901b75d558514063c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/146861
Reviewed-by: Oleh Prypin <oprypin@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28688}
This commit is contained in:
Mirko Bonadei
2019-07-25 18:38:54 +02:00
committed by Commit Bot
parent be4fcb63a2
commit 67f88a0d30
3 changed files with 40 additions and 30 deletions

View File

@ -9,10 +9,14 @@
"""Utilities for all our deps-management stuff."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import shutil
import sys
import subprocess
import sys
import tarfile
import time
import zipfile
@ -26,15 +30,15 @@ def RunSubprocessWithRetry(cmd):
return
except subprocess.CalledProcessError as exception:
backoff = pow(2, i)
print 'Got %s, retrying in %d seconds...' % (exception, backoff)
print('Got %s, retrying in %d seconds...' % (exception, backoff))
time.sleep(backoff)
print 'Giving up.'
print('Giving up.')
raise exception
def DownloadFilesFromGoogleStorage(path, auto_platform=True):
print 'Downloading files in %s...' % path
print('Downloading files in %s...' % path)
extension = 'bat' if 'win32' in sys.platform else 'py'
cmd = ['download_from_google_storage.%s' % extension,
@ -64,20 +68,20 @@ def RemoveDirectory(*path):
works. :/
"""
file_path = os.path.join(*path)
print 'Deleting `{}`.'.format(file_path)
print('Deleting `{}`.'.format(file_path))
if not os.path.exists(file_path):
print '`{}` does not exist.'.format(file_path)
print('`{}` does not exist.'.format(file_path))
return
if sys.platform == 'win32':
# Give up and use cmd.exe's rd command.
file_path = os.path.normcase(file_path)
for _ in xrange(3):
print 'RemoveDirectory running %s' % (' '.join(
['cmd.exe', '/c', 'rd', '/q', '/s', file_path]))
print('RemoveDirectory running %s' % (' '.join(
['cmd.exe', '/c', 'rd', '/q', '/s', file_path])))
if not subprocess.call(['cmd.exe', '/c', 'rd', '/q', '/s', file_path]):
break
print ' Failed'
print(' Failed')
time.sleep(3)
return
else:
@ -93,7 +97,7 @@ def UnpackArchiveTo(archive_path, output_dir):
def _UnzipArchiveTo(archive_path, output_dir):
print 'Unzipping {} in {}.'.format(archive_path, output_dir)
print('Unzipping {} in {}.'.format(archive_path, output_dir))
zip_file = zipfile.ZipFile(archive_path)
try:
zip_file.extractall(output_dir)
@ -102,7 +106,7 @@ def _UnzipArchiveTo(archive_path, output_dir):
def _UntarArchiveTo(archive_path, output_dir):
print 'Untarring {} in {}.'.format(archive_path, output_dir)
print('Untarring {} in {}.'.format(archive_path, output_dir))
tar_file = tarfile.open(archive_path, 'r:gz')
try:
tar_file.extractall(output_dir)