Chromium Code Reviews| Index: tools/build.py |
| diff --git a/tools/build.py b/tools/build.py |
| index 4dfb02441e4dbc63861f59825e9f3534a1b39622..e101f555b920bcbcd0f16c3b9ae722dd0b37d8ec 100755 |
| --- a/tools/build.py |
| +++ b/tools/build.py |
| @@ -1,6 +1,6 @@ |
| #!/usr/bin/env python |
| # |
| -# Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| +# Copyright (c) 2014, the Dart 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. |
| # |
| @@ -8,7 +8,6 @@ |
| import optparse |
| import os |
| import re |
| -import shutil |
| import subprocess |
| import sys |
| import time |
| @@ -69,13 +68,14 @@ def BuildOptions(): |
| return result |
| -def ProcessOsOption(os): |
| - if os == 'host': |
| +def ProcessOsOption(os_name): |
| + if os_name == 'host': |
| return HOST_OS |
| - return os |
| + return os_name |
| def ProcessOptions(options, args): |
| + global arch |
|
ricow1
2014/06/27 07:35:34
I don't think we need this
|
| if options.arch == 'all': |
| options.arch = 'ia32,x64,simarm,simmips,simarm64' |
| if options.mode == 'all': |
| @@ -95,46 +95,46 @@ def ProcessOptions(options, args): |
| if not arch in archs: |
| print "Unknown arch %s" % arch |
| return False |
| - options.os = [ProcessOsOption(os) for os in options.os] |
| - for os in options.os: |
| - if not os in ['android', 'freebsd', 'linux', 'macos', 'win32']: |
| - print "Unknown os %s" % os |
| + options.os = [ProcessOsOption(os_name) for os_name in options.os] |
| + for os_name in options.os: |
| + if not os_name in ['android', 'freebsd', 'linux', 'macos', 'win32']: |
| + print "Unknown os %s" % os_name |
| return False |
| - if os != HOST_OS: |
| - if os != 'android': |
| - print "Unsupported target os %s" % os |
| + if os_name != HOST_OS: |
| + if os_name != 'android': |
| + print "Unsupported target os %s" % os_name |
| return False |
| if not HOST_OS in ['linux']: |
| print ("Cross-compilation to %s is not supported on host os %s." |
| - % (os, HOST_OS)) |
| + % (os_name, HOST_OS)) |
| return False |
| if not arch in ['ia32', 'arm', 'mips']: |
| print ("Cross-compilation to %s is not supported for architecture %s." |
| - % (os, arch)) |
| + % (os_name, arch)) |
| return False |
| # We have not yet tweaked the v8 dart build to work with the Android |
| # NDK/SDK, so don't try to build it. |
| - if args == []: |
| + if not args: |
| print "For android builds you must specify a target, such as 'runtime'." |
| return False |
| return True |
| -def SetTools(arch, target_os, toolchainprefix): |
| +def SetTools(sys_arch, target_os, toolchainprefix): |
| toolsOverride = None |
| # For Android, by default use the toolchain from third_party/android_tools. |
| - if target_os == 'android' and toolchainprefix == None: |
| - android_toolchain = GetAndroidToolchainDir(HOST_OS, arch) |
| - if arch == 'arm': |
| + if target_os == 'android' and toolchainprefix is None: |
| + android_toolchain = GetAndroidToolchainDir(HOST_OS, sys_arch) |
| + if sys_arch == 'arm': |
| toolchainprefix = os.path.join( |
| android_toolchain, 'arm-linux-androideabi') |
| - if arch == 'ia32': |
| + if sys_arch == 'ia32': |
| toolchainprefix = os.path.join( |
| android_toolchain, 'i686-linux-android') |
| # For ARM Linux, by default use the Linux distribution's cross-compiler. |
| - if arch == 'arm' and toolchainprefix == None: |
| + if sys_arch == 'arm' and toolchainprefix is None: |
| # We specify the hf compiler. If this changes, we must also remove |
| # the ARM_FLOAT_ABI_HARD define in configurations_make.gypi. |
| toolchainprefix = (DEFAULT_ARM_CROSS_COMPILER_PATH + |
| @@ -175,7 +175,7 @@ def GetAndroidToolchainDir(host_os, target_arch): |
| raise Exception('Unsupported target architecture %s' % target_arch) |
| # Set up path to the Android NDK. |
| - CheckDirExists(THIRD_PARTY_ROOT, 'third party tools'); |
| + CheckDirExists(THIRD_PARTY_ROOT, 'third party tools') |
| android_tools = os.path.join(THIRD_PARTY_ROOT, 'android_tools') |
| CheckDirExists(android_tools, 'Android tools') |
| android_ndk_root = os.path.join(android_tools, 'ndk') |
| @@ -232,9 +232,9 @@ PhaseScriptExecution "Action \"upload_sdk_py\"" xcodebuild/dart.build/... |
| """ |
| - def is_empty_chunk(chunk): |
| + def is_empty_chunk(input): |
| empty_chunk = ['', 'Check dependencies', ''] |
| - return not chunk or (len(chunk) == 4 and chunk[1:] == empty_chunk) |
| + return not input or (len(input) == 4 and input[1:] == empty_chunk) |
| def unbuffered(callable): |
| # Use iter to disable buffering in for-in. |
| @@ -312,7 +312,7 @@ def NotifyBuildDone(build_config, success, start): |
| # Display a notification if build time exceeded DART_BUILD_NOTIFICATION_DELAY. |
| notification_delay = float( |
| - os.getenv('DART_BUILD_NOTIFICATION_DELAY', default=sys.float_info.max)) |
| + os.getenv('DART_BUILD_NOTIFICATION_DELAY', sys.float_info.max)) |
| if (time.time() - start) < notification_delay: |
| return |
| @@ -436,7 +436,7 @@ def Main(): |
| 'BUILDTYPE=' + build_config, |
| ] |
| if target_os != HOST_OS: |
| - args += ['builddir_name=' + utils.GetBuildDir(HOST_OS, target_os)] |
| + args += ['builddir_name=' + utils.GetBuildDir(HOST_OS)] |
| if options.verbose: |
| args += ['V=1'] |
| @@ -458,7 +458,6 @@ def Main(): |
| print ' '.join(args) |
| - process = None |
| if filter_xcodebuild_output: |
| process = subprocess.Popen(args, |
| stdin=None, |