diff --git a/Documentation/replace_macros.py b/Documentation/replace_macros.py index baf08e7d58..2996a98aea 100755 --- a/Documentation/replace_macros.py +++ b/Documentation/replace_macros.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # coding=utf-8 # Copyright (C) 2013 The Android Open Source Project # diff --git a/tools/bzl/license.bzl b/tools/bzl/license.bzl index 38dfbe5e28..357817303a 100644 --- a/tools/bzl/license.bzl +++ b/tools/bzl/license.bzl @@ -25,7 +25,7 @@ def license_map(name, targets = [], opts = [], **kwargs): # post process the XML into our favorite format. native.genrule( name = "gen_license_txt_" + name, - cmd = "python $(location //tools/bzl:license-map.py) %s %s > $@" % (" ".join(opts), " ".join(xmls)), + cmd = "python2 $(location //tools/bzl:license-map.py) %s %s > $@" % (" ".join(opts), " ".join(xmls)), outs = [ name + ".txt" ], tools = tools, **kwargs diff --git a/tools/eclipse/project.py b/tools/eclipse/project.py index 448d940a99..9f8b4b7419 100755 --- a/tools/eclipse/project.py +++ b/tools/eclipse/project.py @@ -277,7 +277,7 @@ def gen_factorypath(ext): doc.writexml(fd, addindent='\t', newl='\n', encoding='UTF-8') try: - ext_location = retrieve_ext_location() + ext_location = retrieve_ext_location().decode("utf-8") gen_project(args.project_name) gen_classpath(ext_location) gen_factorypath(ext_location) diff --git a/tools/js/bowerutil.py b/tools/js/bowerutil.py index 8e8e835a46..c2e11cdde2 100644 --- a/tools/js/bowerutil.py +++ b/tools/js/bowerutil.py @@ -40,7 +40,7 @@ def hash_bower_component(hash_obj, path): if f == '.bower.json': continue p = os.path.join(root, f) - hash_obj.update(p[len(path)+1:]) - hash_obj.update(open(p).read()) + hash_obj.update(p[len(path)+1:].encode("utf-8")) + hash_obj.update(open(p, "rb").read()) return hash_obj diff --git a/tools/js/download_bower.py b/tools/js/download_bower.py index f5b7bf57cc..1c8d45e237 100755 --- a/tools/js/download_bower.py +++ b/tools/js/download_bower.py @@ -68,7 +68,7 @@ def ignore_deps(info): deps = info.get('dependencies') if deps: with open(os.path.join('.bowerrc'), 'w') as f: - json.dump({'ignoredDependencies': deps.keys()}, f) + json.dump({'ignoredDependencies': list(deps.keys())}, f) def cache_entry(name, package, version, sha1): diff --git a/tools/js/npm_pack.py b/tools/js/npm_pack.py index 9e8482e17a..de45083f7b 100755 --- a/tools/js/npm_pack.py +++ b/tools/js/npm_pack.py @@ -42,7 +42,7 @@ def is_bundled(tar): def bundle_dependencies(): with open('package.json') as f: package = json.load(f) - package['bundledDependencies'] = package['dependencies'].keys() + package['bundledDependencies'] = list(package['dependencies'].keys()) with open('package.json', 'w') as f: json.dump(package, f)