diff options
author | Chris Johns <chrisj@rtems.org> | 2013-05-10 11:10:40 +1000 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2013-05-10 11:18:41 +1000 |
commit | 8ee84604b0b3c985d0eb8ef576232d234e4e4e07 (patch) | |
tree | d1f89d309a05e63c33c194b41a5f446f4b429c81 | |
parent | MIPS patches in newlib head and we are using that. (diff) | |
download | rtems-source-builder-8ee84604b0b3c985d0eb8ef576232d234e4e4e07.tar.bz2 |
Add check_output if on Python 2.6, ie CentOS.
-rw-r--r-- | source-builder/sb/bootstrap.py | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/source-builder/sb/bootstrap.py b/source-builder/sb/bootstrap.py index f433949..0801fc5 100644 --- a/source-builder/sb/bootstrap.py +++ b/source-builder/sb/bootstrap.py @@ -22,7 +22,6 @@ import datetime import operator import os import re -import subprocess import sys import threading import time @@ -61,6 +60,27 @@ class command: self.cwd = cwd def runner(self): + + import subprocess + + # + # Support Python 2.6 + # + if "check_output" not in dir(subprocess): + def f(*popenargs, **kwargs): + if 'stdout' in kwargs: + raise ValueError('stdout argument not allowed, it will be overridden.') + process = subprocess.Popen(stdout=subprocess.PIPE, *popenargs, **kwargs) + output, unused_err = process.communicate() + retcode = process.poll() + if retcode: + cmd = kwargs.get("args") + if cmd is None: + cmd = popenargs[0] + raise CalledProcessError(retcode, cmd) + return output + subprocess.check_output = f + self.start_time = datetime.datetime.now() self.exit_code = 0 try: |