build/pymake/make.py
author Joshua Cranmer <Pidgeot18@gmail.com>
Mon, 12 May 2014 09:14:06 -0500
changeset 20097 e41e714750eb242b1a6022b346717076d91f0bb3
parent 15096 4c46112cb67718e10cd8043d87984ef37b52acbd
child 19446 f33a09c318a931a48057d03b9fa4077afb39fe68
child 20318 9e17f6ef66201825449ab40323012e1e27399a4b
permissions -rw-r--r--
Bug 1006498 - Import nsCharsetConverterManager into c-c. r=Neil, patch originally due to Henri Sivonen. CLOSED TREE.

#!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

# This is a wrapper around mozilla-central's pymake. If that isn't found then
# this uses client.py to pull it in.

import os
import sys
import subprocess
import shlex

def getpath(relpath):
    thisdir = os.path.dirname(__file__)
    return os.path.abspath(os.path.join(thisdir, *relpath))

PYMAKE = getpath(["..", "..", "mozilla", "build", "pymake", "make.py"])
CLIENT_PY = getpath(["..", "..", "client.py"])
CLIENT_PY_ARGS = getpath(["..", "client.py-args"])

def main(args):
    if not os.path.exists(PYMAKE):
        clientpyargs = open(CLIENT_PY_ARGS, "r").read().strip()
        clientpyargs = shlex.split(clientpyargs)
        subprocess.check_call([sys.executable, CLIENT_PY, "checkout"] +
                              clientpyargs)

        if not os.path.exists(PYMAKE):
            raise Exception("Pymake not found even after client.py was run")

    subprocess.check_call([sys.executable, PYMAKE] + args)

if __name__ == "__main__":
    main(sys.argv[1:])