Chromium Code Reviews| Index: frog/frog.py |
| =================================================================== |
| --- frog/frog.py (revision 1968) |
| +++ frog/frog.py (working copy) |
| @@ -19,7 +19,7 @@ |
| import sys |
| -from os.path import dirname, join, realpath, exists |
| +from os.path import dirname, join, realpath, exists, basename |
| HOME = dirname(realpath(__file__)) |
| sys.path.append(join(HOME, os.pardir, 'tools')) |
| @@ -34,35 +34,24 @@ |
| ''' |
| def GetDart(): |
| - # Try a release version |
| - dart = utils.GetDartRunner('release', 'ia32', 'vm') |
| - if exists(dart): return dart |
| - # Try at the top level |
| - dart = join(os.pardir, dart) |
| - if exists(dart): return dart |
| + # Get the release version. |
| + return utils.GetDartRunner('release', 'ia32', 'vm') |
| - # Try a debug version |
| - dart = utils.GetDartRunner('debug', 'ia32', 'vm') |
| - if exists(dart): return dart |
| - # Try at the top level |
| - dart = join(os.pardir, dart) |
| - return dart |
| +def CheckUpdatedReleaseVersion(dart): |
|
ahe
2011/12/01 12:38:54
This is a weird name.
ngeoffray
2011/12/01 12:53:33
Yes, forgot to upload the last version. Renamed to
|
| + product_dir = dirname(dart) |
| + out_dir = dirname(product_dir) |
| + config = basename(product_dir) |
| -def GetD8(): |
| - system = utils.GuessOS() |
| - d8 = join(utils.GetBuildRoot(system, 'release', 'ia32'), 'd8') |
| - if exists(d8): return d8 |
| - # Try at the top level |
| - d8 = join(os.pardir, d8) |
| - if exists(d8): return d8 |
| + if config.find('Debug') != -1: |
| + dart_release = join(out_dir, config.replace('Debug', 'Release'), 'dart') |
| + else: |
| + dart_release = dart |
| - # Try a debug version |
| - d8 = join(utils.GetBuildRoot(system, 'debug', 'ia32'), 'd8') |
| - if exists(d8): return d8 |
| - # Try at the top level |
| - d8 = join(os.pardir, d8) |
| - return d8 |
| + return dart_release |
| +def GetD8(): |
| + return join(dirname(GetDart()), 'd8') |
| + |
| D8 = GetD8() |
| def execute(cmd): |
| @@ -92,6 +81,10 @@ |
| default='', |
| help='Flags to pass to the VM that is running frog itself.') |
| + optionParser.add_option('--vm', |
| + default=GetDart(), |
| + help='The location of the VM.') |
| + |
| optionParser.add_option('--js_cmd', |
| default = 'node --crankshaft', # node is really slow without this. |
| metavar='FILE', help='The shell cmd to use to run output JS code.') |
| @@ -131,11 +124,13 @@ |
| optionParser.print_help() |
| return 1 |
| - dart = GetDart() |
| + dart = CheckUpdatedReleaseVersion(options.vm) |
| if not exists(dart): |
| - print("Dart VM not configured in %s," % dart), |
| - print "run the following command from the dart directory" |
| - print " tools/build.py -m release" |
| + print "Dart VM not built. Please run the following command:" |
| + if os.path.basename(realpath(os.curdir)) == 'frog': |
|
ahe
2011/12/01 12:38:54
I'm not sure about this. I'll explain in person.
ngeoffray
2011/12/01 12:53:33
Thanks. Changed to use:
relpath(join(HOME, os.pard
|
| + print " ../tools/build.py -m release" |
| + else: |
| + print " ./tools/build.py -m release" |
| return 1 |
| if subprocess.call("node --help >/dev/null 2>&1", shell=True): |