Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Unified Diff: tools/build.py

Issue 350483003: Build Tools Cleanup (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: more cleanup Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/build.py
diff --git a/tools/build.py b/tools/build.py
index 4dfb02441e4dbc63861f59825e9f3534a1b39622..0b6c601129cb14cb6371958aa1e0f59cd7603be1 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
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,13 +232,13 @@ PhaseScriptExecution "Action \"upload_sdk_py\"" xcodebuild/dart.build/...
"""
- def is_empty_chunk(chunk):
+ def is_empty_chunk(the_chunk):
ricow1 2014/06/24 07:41:55 the_chunk -> input
empty_chunk = ['', 'Check dependencies', '']
- return not chunk or (len(chunk) == 4 and chunk[1:] == empty_chunk)
+ return not the_chunk or (len(the_chunk) == 4 and the_chunk[1:] == empty_chunk)
kustermann 2014/06/23 07:56:42 long line
- def unbuffered(callable):
+ def unbuffered(the_callable):
ricow1 2014/06/24 07:41:54 the_callable -> input or stream
ricow1 2014/06/24 07:41:55 the_callable -> input
# Use iter to disable buffering in for-in.
- return iter(callable, '')
+ return iter(the_callable, '')
section = None
chunk = []
@@ -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
@@ -379,10 +379,10 @@ def Main():
for target in targets:
for target_os in options.os:
for mode in options.mode:
- for arch in options.arch:
+ for the_arch in options.arch:
ricow1 2014/06/24 07:41:55 what is arch shadowing? Is this simply because you
start_time = time.time()
os.environ['DART_BUILD_MODE'] = mode
- build_config = utils.GetBuildConf(mode, arch, target_os)
+ build_config = utils.GetBuildConf(mode, the_arch, target_os)
if HOST_OS == 'macos':
filter_xcodebuild_output = True
project_file = 'dart.xcodeproj'
@@ -402,12 +402,12 @@ def Main():
if os.path.exists('dart-%s.gyp' % CurrentDirectoryBaseName()):
project_file = 'dart-%s.sln' % CurrentDirectoryBaseName()
# Select a platform suffix to pass to devenv.
- if arch == 'ia32':
+ if the_arch == 'ia32':
platform_suffix = 'Win32'
- elif arch == 'x64':
+ elif the_arch == 'x64':
platform_suffix = 'x64'
else:
- print 'Unsupported arch for MSVC build: %s' % arch
+ print 'Unsupported arch for MSVC build: %s' % the_arch
return 1
config_name = '%s|%s' % (build_config, platform_suffix)
if target == 'all':
@@ -436,21 +436,21 @@ 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']
args += [target]
toolchainprefix = options.toolchain
- toolsOverride = SetTools(arch, target_os, toolchainprefix)
+ toolsOverride = SetTools(the_arch, target_os, toolchainprefix)
if toolsOverride:
for k, v in toolsOverride.iteritems():
args.append( k + "=" + v)
if options.verbose:
print k + " = " + v
if not os.path.isfile(toolsOverride['CC.target']):
- if arch == 'arm':
+ if the_arch == 'arm':
print arm_cc_error
else:
print "Couldn't find compiler: %s" % toolsOverride['CC.target']
@@ -458,7 +458,6 @@ def Main():
print ' '.join(args)
- process = None
if filter_xcodebuild_output:
process = subprocess.Popen(args,
stdin=None,

Powered by Google App Engine
This is Rietveld 408576698