Chromium Code Reviews| Index: build/linux/install-debian.wheezy.sysroot.wrapper.py |
| =================================================================== |
| --- build/linux/install-debian.wheezy.sysroot.wrapper.py (revision 198820) |
| +++ build/linux/install-debian.wheezy.sysroot.wrapper.py (working copy) |
| @@ -1,4 +1,4 @@ |
| -#!/bin/sh |
| +#!/usr/bin/env python |
| # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| @@ -17,13 +17,31 @@ |
| # |
| # * chromeos=1 |
| -set -e |
| +import os.path |
| +import subprocess |
|
Dan Beam
2013/05/08 08:33:30
not sure if we're supposed to be using subproccess
Lei Zhang
2013/05/08 08:42:10
Isn't subprocess2 in depot_tools? Everything in sr
Dan Beam
2013/05/08 09:06:47
ah, ok, ignore me then
|
| +import sys |
| -SRC_DIR="$(dirname "$0")/../../" |
| -SCRIPT_DIR="chrome/installer/linux/internal/sysroot_scripts/" |
| -SCRIPT_FILE="$SRC_DIR/$SCRIPT_DIR/install-debian.wheezy.sysroot.py" |
| +def main(): |
| + if sys.platform != 'linux2': |
| + return 0 |
| -if [ -e "$SCRIPT_FILE" ]; then |
| - python "$SCRIPT_FILE" --linux-only --arch=amd64 |
| - python "$SCRIPT_FILE" --linux-only --arch=i386 |
| -fi |
| + SRC_DIR = os.path.dirname(os.path.dirname(os.path.dirname( |
| + os.path.realpath(__file__)))) |
|
Dan Beam
2013/05/08 08:33:30
this is slightly hacky, but not the end of the wor
|
| + SCRIPT_FILE = os.path.join(SRC_DIR, |
| + 'chrome', |
| + 'installer', |
| + 'linux', |
| + 'internal', |
| + 'sysroot_scripts', |
| + 'install-debian.wheezy.sysroot.py') |
| + if os.path.exists(SCRIPT_FILE): |
|
Dan Beam
2013/05/08 08:33:30
is it OK that the file doesn't exist?
Lei Zhang
2013/05/08 08:42:10
Yes, see the bash script this converts from.
|
| + ret = subprocess.call([SCRIPT_FILE, '--linux-only', '--arch=amd64']) |
|
Dan Beam
2013/05/08 08:33:30
most of the scripts I've seen use .communicate to
Lei Zhang
2013/05/08 08:42:10
We don't need to process the output.
|
| + if ret != 0: |
| + return ret |
| + ret = subprocess.call([SCRIPT_FILE, '--linux-only', '--arch=i386']) |
| + if ret != 0: |
| + return ret |
| + return 0 |
| + |
| +if __name__ == '__main__': |
| + sys.exit(main()) |