summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2013-05-10 11:10:40 +1000
committerChris Johns <chrisj@rtems.org>2013-05-10 11:18:41 +1000
commit8ee84604b0b3c985d0eb8ef576232d234e4e4e07 (patch)
treed1f89d309a05e63c33c194b41a5f446f4b429c81
parentMIPS patches in newlib head and we are using that. (diff)
downloadrtems-source-builder-8ee84604b0b3c985d0eb8ef576232d234e4e4e07.tar.bz2
Add check_output if on Python 2.6, ie CentOS.
-rw-r--r--source-builder/sb/bootstrap.py22
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: