| Index: samples/total/bin/start-total
|
| ===================================================================
|
| --- samples/total/bin/start-total (revision 9011)
|
| +++ samples/total/bin/start-total (working copy)
|
| @@ -1,72 +0,0 @@
|
| -#!/usr/bin/env python2.6
|
| -# Copyright (c) 2011, 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.
|
| -
|
| -import optparse
|
| -import os
|
| -import subprocess
|
| -import sys
|
| -import shutil
|
| -
|
| -ROOT=os.path.abspath(
|
| - os.path.join(os.path.dirname(sys.argv[0]), '../../../'))
|
| -def rootPath(*args):
|
| - return os.path.join(ROOT, *args)
|
| -
|
| -HERE = rootPath('samples/total')
|
| -def herePath(*args):
|
| - return os.path.join(HERE, *args)
|
| -
|
| -sys.path.append(rootPath('tools'))
|
| -import utils
|
| -
|
| -def GetOutputPath(mode):
|
| - return rootPath(
|
| - utils.GetBuildRoot(utils.GuessOS(), mode, utils.GuessArchitecture()),
|
| - 'dart')
|
| -
|
| -def BuildDart(mode):
|
| - if subprocess.call([
|
| - 'tools/build.py',
|
| - '--mode=%s' % mode],
|
| - cwd = ROOT) != 0:
|
| - return False
|
| - return True
|
| -
|
| -def RunTotal(mode):
|
| - serverPath = herePath('server')
|
| - # Update dart.js
|
| - outJsPath = serverPath + '/out';
|
| - if not os.path.exists(outJsPath):
|
| - os.makedirs(outJsPath)
|
| - shutil.copy(rootPath('client/dart.js'), outJsPath)
|
| - dartExePath = GetOutputPath(mode)
|
| - if not os.path.exists(dartExePath):
|
| - raise Exception("Couldn't find dart executable at " + dartExePath)
|
| - subprocess.check_call(
|
| - [dartExePath, 'TotalRunner.dart'],
|
| - cwd = serverPath)
|
| -
|
| -def main():
|
| - parser = optparse.OptionParser()
|
| - parser.add_option('--no-build',
|
| - dest = 'build',
|
| - action = 'store_false',
|
| - default = True,
|
| - help = 'Skip reubilding of dart')
|
| - parser.add_option('--mode',
|
| - dest = 'mode',
|
| - default = "release",
|
| - help = 'Mode to use when building dependencies (release or debug)')
|
| - options, args = parser.parse_args()
|
| - if options.build:
|
| - result = BuildDart(options.mode)
|
| - if not result:
|
| - print('Aborting servers startup - build failed. (bypass with --no-build).')
|
| - return 1
|
| - RunTotal(options.mode)
|
| - return 0
|
| -
|
| -if __name__ == '__main__':
|
| - sys.exit(main())
|
|
|