Update create_jctf_tests.py and download_from_x20.py to python3
Change-Id: I0a4a2a4a229e777d2f4eaab103fa7d6b8e2d7af2
diff --git a/tools/create_jctf_tests.py b/tools/create_jctf_tests.py
index bc065d9..38e1f9c 100755
--- a/tools/create_jctf_tests.py
+++ b/tools/create_jctf_tests.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# Copyright (c) 2017, the R8 project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
@@ -9,7 +9,7 @@
from os import makedirs
from os.path import exists, join, dirname
from shutil import rmtree
-from string import Template, upper
+from string import Template
import os
import re
import sys
diff --git a/tools/download_from_x20.py b/tools/download_from_x20.py
index 5f64684..5796823 100755
--- a/tools/download_from_x20.py
+++ b/tools/download_from_x20.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# Copyright (c) 2016, the R8 project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
@@ -20,7 +20,7 @@
return optparse.OptionParser().parse_args()
def download(src, dest):
- print 'Downloading %s to %s' % (src, dest)
+ print('Downloading %s to %s' % (src, dest))
shutil.copyfile(src, dest)
utils.unpack_archive(dest)
@@ -29,21 +29,21 @@
assert len(args) == 1
sha1_file = args[0]
dest = sha1_file[:-5]
- print 'Ensuring %s' % dest
+ print('Ensuring %s' % dest)
with open(sha1_file, 'r') as input_sha:
sha1 = input_sha.readline()
if os.path.exists(dest) and utils.get_sha1(dest) == sha1:
- print 'sha1 matches, not downloading'
+ print('sha1 matches, not downloading')
dest_dir = utils.extract_dir(dest)
if os.path.exists(dest_dir):
- print 'destination directory exists, no extraction'
+ print('destination directory exists, no extraction')
else:
utils.unpack_archive(dest)
return
src = os.path.join(GMSCORE_DEPS, sha1)
if not os.path.exists(src):
- print 'File (%s) does not exist on x20' % src
- print 'Maybe pass -Pno_internal to your gradle invocation'
+ print('File (%s) does not exist on x20' % src)
+ print('Maybe pass -Pno_internal to your gradle invocation')
return 42
download(src, dest)