diff options
author | Bogdano Arendartchuk <bogdano@mandriva.org> | 2009-04-17 17:24:30 +0000 |
---|---|---|
committer | Bogdano Arendartchuk <bogdano@mandriva.org> | 2009-04-17 17:24:30 +0000 |
commit | 4117452de5b810861a877a6a4e751bebf97c1e01 (patch) | |
tree | 84a8464a3d1b8ae93accb9c556335b66c717ee04 /BuildManager | |
parent | dfc59354a7e3adfb5789b60d2375d1f0c5739750 (diff) | |
download | bm-4117452de5b810861a877a6a4e751bebf97c1e01.tar bm-4117452de5b810861a877a6a4e751bebf97c1e01.tar.gz bm-4117452de5b810861a877a6a4e751bebf97c1e01.tar.bz2 bm-4117452de5b810861a877a6a4e751bebf97c1e01.tar.xz bm-4117452de5b810861a877a6a4e751bebf97c1e01.zip |
Use the subprocess module, as popen is deprecated on py2.6
Diffstat (limited to 'BuildManager')
-rw-r--r-- | BuildManager/build.py | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/BuildManager/build.py b/BuildManager/build.py index 8fed7b0..9279d17 100644 --- a/BuildManager/build.py +++ b/BuildManager/build.py @@ -2,10 +2,7 @@ from BuildManager.fileutil import * from BuildManager.package import * from BuildManager import * import thread -import popen2 -import select -import fcntl -import thread +import subprocess import sys, os import time import shutil @@ -204,22 +201,18 @@ def buildpkg(pkg, stage, unpack_dir, passtrough="", show_log=0, dryrun=0): logger.debug("rpmbuild command: "+cmd) if not dryrun: log = open(pkg.log, "w") - pop = popen2.Popen3(cmd) - fc = pop.fromchild - flags = fcntl.fcntl (fc.fileno(), fcntl.F_GETFL, 0) - flags = flags | os.O_NONBLOCK - fcntl.fcntl (fc.fileno(), fcntl.F_SETFL, flags) - while 1: - r,w,x = select.select([fc.fileno()], [], [], 2) - if r: - data = fc.read() - if show_log: - sys.stdout.write(data) - log.write(data) - log.flush() + pop = subprocess.Popen(cmd, shell=True, + stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + of = pop.stdout.fileno() + while True: status = pop.poll() - if status != -1: + if status is not None: break + data = os.read(of, 8192) + log.write(data) + log.flush() + if show_log: + sys.stdout.write(data) log.close() if status == 0: logger.info("succeeded!") |