[Autotest] making /utils py3 compatible
This will allow unittests to by run in python3, thus allowing other
modules to be tested in py3 when migrating.
BUG=chromium:990593
TEST=Ran a unittest in python3 and it worked, python3 -m py_compile
Change-Id: Idd8bae0c4157cdbd6c58b2497b1938b72a62031f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/2324811
Reviewed-by: Greg Edelston <gredelston@google.com>
Reviewed-by: Congbin Guo <guocb@chromium.org>
Tested-by: Derek Beckett <dbeckett@chromium.org>
Commit-Queue: Derek Beckett <dbeckett@chromium.org>
diff --git a/utils/compile_gwt_clients.py b/utils/compile_gwt_clients.py
index be12f37..6047040 100755
--- a/utils/compile_gwt_clients.py
+++ b/utils/compile_gwt_clients.py
@@ -1,12 +1,23 @@
#!/usr/bin/env python2
+
+from __future__ import print_function
+from __future__ import division
+from __future__ import absolute_import
+
import common
import sys, os, shutil, optparse, logging
+import six
+
from autotest_lib.client.common_lib import error, utils
from autotest_lib.client.common_lib import logging_config, logging_manager
+
+
"""
Compile All Autotest GWT Clients Living in autotest/frontend/client/src
"""
+
+
_AUTOTEST_DIR = common.autotest_dir
_DEFAULT_GWT_DIRS = ['/usr/local/lib/gwt', '/opt/google-web-toolkit']
_DEFAULT_APP_DIR = os.path.join(_AUTOTEST_DIR, 'frontend/client')
@@ -76,7 +87,7 @@
try:
os.rename(tmp_client_dir, install_dir)
return True
- except Exception, err:
+ except Exception as err:
# If we can't rename the client raise an exception
# and put the old client back
shutil.rmtree(install_dir)
@@ -122,7 +133,7 @@
@returns list of failed client installations
"""
failed_clients = []
- for project,clients in enumerate_projects().iteritems():
+ for project,clients in six.iteritems(enumerate_projects()):
for client in clients:
project_client = '%s.%s' % (project, client)
if not compile_and_install_client(project_client, extra_args):
@@ -133,7 +144,7 @@
def print_projects():
logging.info('Projects that can be compiled:')
- for project,clients in enumerate_projects().iteritems():
+ for project,clients in six.iteritems(enumerate_projects()):
for client in clients:
logging.info('%s.%s', project, client)