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

Side by Side Diff: tools/utils.py

Issue 397593006: Fixes create_sdk target for cross-builds. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« tools/build.py ('K') | « tools/build.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 # for details. All rights reserved. Use of this source code is governed by a 2 # for details. All rights reserved. Use of this source code is governed by a
3 # BSD-style license that can be found in the LICENSE file. 3 # BSD-style license that can be found in the LICENSE file.
4 4
5 # This file contains a set of utilities functions used by other Python-based 5 # This file contains a set of utilities functions used by other Python-based
6 # scripts. 6 # scripts.
7 7
8 import commands 8 import commands
9 import os 9 import os
10 import platform 10 import platform
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 if platform.system() == 'Windows': 235 if platform.system() == 'Windows':
236 gsutil = 'e:\\\\b\\build\\scripts\\slave\\gsutil' 236 gsutil = 'e:\\\\b\\build\\scripts\\slave\\gsutil'
237 return gsutil 237 return gsutil
238 238
239 def GetBuildMode(mode): 239 def GetBuildMode(mode):
240 return BUILD_MODES[mode] 240 return BUILD_MODES[mode]
241 241
242 def GetArchFamily(arch): 242 def GetArchFamily(arch):
243 return ARCH_FAMILY[arch] 243 return ARCH_FAMILY[arch]
244 244
245 def IsCrossBuild(target_os, arch):
246 host_arch = ARCH_GUESS
247 if ((GetArchFamily(host_arch) != GetArchFamily(arch)) or
Bill Hesse 2014/07/16 07:35:43 Why not just return the boolean expression?
zra 2014/07/16 14:48:20 Done.
248 (target_os != GuessOS())):
249 return True
250 return False
251
245 def GetBuildConf(mode, arch, conf_os=None): 252 def GetBuildConf(mode, arch, conf_os=None):
246 if conf_os == 'android': 253 if conf_os == 'android':
247 return '%s%s%s' % (GetBuildMode(mode), conf_os.title(), arch.upper()) 254 return '%s%s%s' % (GetBuildMode(mode), conf_os.title(), arch.upper())
248 else: 255 else:
249 # Ask for a cross build if the host and target architectures don't match. 256 # Ask for a cross build if the host and target architectures don't match.
250 host_arch = ARCH_GUESS 257 host_arch = ARCH_GUESS
251 cross_build = '' 258 cross_build = ''
252 if GetArchFamily(host_arch) != GetArchFamily(arch): 259 if GetArchFamily(host_arch) != GetArchFamily(arch):
253 print "GetBuildConf: Cross-build of %s on %s\n" % (arch, host_arch) 260 print "GetBuildConf: Cross-build of %s on %s\n" % (arch, host_arch)
254 cross_build = 'X' 261 cross_build = 'X'
255 return '%s%s%s' % (GetBuildMode(mode), cross_build, arch.upper()) 262 return '%s%s%s' % (GetBuildMode(mode), cross_build, arch.upper())
256 263
257 def GetBuildDir(host_os, target_os): 264 def GetBuildDir(host_os, target_os):
258 return BUILD_ROOT[host_os] 265 return BUILD_ROOT[host_os]
259 266
260 def GetBuildRoot(host_os, mode=None, arch=None, target_os=None): 267 def GetBuildRoot(host_os, mode=None, arch=None, target_os=None):
261 build_root = GetBuildDir(host_os, target_os) 268 build_root = GetBuildDir(host_os, target_os)
262 if mode: 269 if mode:
263 build_root = os.path.join(build_root, GetBuildConf(mode, arch)) 270 build_root = os.path.join(build_root, GetBuildConf(mode, arch, target_os))
264 return build_root 271 return build_root
265 272
266 def GetBaseDir(): 273 def GetBaseDir():
267 return BASE_DIR 274 return BASE_DIR
268 275
269 def GetShortVersion(): 276 def GetShortVersion():
270 version = ReadVersionFile() 277 version = ReadVersionFile()
271 return ('%s.%s.%s.%s.%s' % ( 278 return ('%s.%s.%s.%s.%s' % (
272 version.major, version.minor, version.patch, version.prerelease, 279 version.major, version.minor, version.patch, version.prerelease,
273 version.prerelease_patch)) 280 version.prerelease_patch))
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 os.chdir(self._working_directory) 591 os.chdir(self._working_directory)
585 592
586 def __exit__(self, *_): 593 def __exit__(self, *_):
587 print "Enter directory = ", self._old_cwd 594 print "Enter directory = ", self._old_cwd
588 os.chdir(self._old_cwd) 595 os.chdir(self._old_cwd)
589 596
590 597
591 if __name__ == "__main__": 598 if __name__ == "__main__":
592 import sys 599 import sys
593 Main(sys.argv) 600 Main(sys.argv)
OLDNEW
« tools/build.py ('K') | « tools/build.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698