aboutsummaryrefslogtreecommitdiff
path: root/build_tc.py
diff options
context:
space:
mode:
authorZhizhou Yang <zhizhouy@google.com>2020-02-10 16:51:20 -0800
committerZhizhou Yang <zhizhouy@google.com>2020-02-12 01:34:49 +0000
commit81d651f89ac91819a77b8bd2ca720646326bf89a (patch)
treeec2f44c02809b95d036a8c619834ec4db8dba2e4 /build_tc.py
parent4b68aee96e6c6b7593b8d91973168c817852b2b2 (diff)
downloadtoolchain-utils-81d651f89ac91819a77b8bd2ca720646326bf89a.tar.gz
toolchain-utils: Partially port scripts to python 3
This patch ports some still-in-use python scripts under root directory of toolchain-utils to python 3. BUG=chromium:1011676 TEST=Passed unittests and tested with manually launching. Change-Id: Id6066944780a7204fe4746cd271f41ac20f2274d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2049103 Commit-Queue: Zhizhou Yang <zhizhouy@google.com> Tested-by: Zhizhou Yang <zhizhouy@google.com> Auto-Submit: Zhizhou Yang <zhizhouy@google.com> Reviewed-by: George Burgess <gbiv@chromium.org>
Diffstat (limited to 'build_tc.py')
-rwxr-xr-xbuild_tc.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/build_tc.py b/build_tc.py
index c14b6905..9b90f55c 100755
--- a/build_tc.py
+++ b/build_tc.py
@@ -1,8 +1,9 @@
-#!/usr/bin/env python2
-#
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
# Copyright 2010 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+
"""Script to build the ChromeOS toolchain.
This script sets up the toolchain if you give it the gcctools directory.
@@ -100,8 +101,9 @@ class ToolchainPart(object):
command = 'mkdir -p %s' % build_dir
self._ce.RunCommand(command)
- mounted_build_dir = os.path.join(self._chromeos_root, 'chroot', '%s-%s' %
- (self._chroot_source_path, build_suffix))
+ mounted_build_dir = os.path.join(
+ self._chromeos_root, 'chroot',
+ '%s-%s' % (self._chroot_source_path, build_suffix))
build_mp = tc_enter_chroot.MountPoint(build_dir, mounted_build_dir,
getpass.getuser())
mount_points.append(build_mp)
@@ -148,10 +150,10 @@ class ToolchainPart(object):
if self._name == 'gcc' and not self._gcc_enable_ccache:
env['USE'] += ' -wrapper_ccache'
- env['%s_SOURCE_PATH' % self._name.upper()] = (os.path.join(
- '/', self._chroot_source_path))
+ env['%s_SOURCE_PATH' % self._name.upper()] = (
+ os.path.join('/', self._chroot_source_path))
env['ACCEPT_KEYWORDS'] = '~*'
- env_string = ' '.join(["%s=\"%s\"" % var for var in env.items()])
+ env_string = ' '.join(['%s="%s"' % var for var in env.items()])
command = 'emerge =cross-%s/%s-9999' % (self._ctarget, self._name)
full_command = 'sudo %s %s' % (env_string, command)
rv = self._ce.ChrootRunCommand(self._chromeos_root, full_command)