def stitch(srcRoot, flags): """ run the stitch program to generate the build file. """ initialCwd = os.getcwd() try: os.chdir(srcRoot) try: shell.sh("stitch", flags) except shell.CommandError, ce: raise BuildError("stitch exited with status " + str(ce.value)) finally: os.chdir(initialCwd)
def buildTask(task, flags): """ run build task, and return the exit status Note that this changes the cwd, so is not thread safe. """ buildRoot = getBuildRoot() initialCwd = os.getcwd() if None == buildRoot: raise BuildError("No buildroot could be found starting at " + initialCwd) try: os.chdir(buildRoot) try: shell.sh(buildRoot + os.sep + "build " + task, flags) except shell.CommandError, ce: raise BuildError("Result code " + str(ce.value) + " when running task " \ + str(task)) finally: os.chdir(initialCwd)