Index: util.py =================================================================== --- util.py (revision 73550) +++ util.py (working copy) @@ -86,18 +86,19 @@ elif os.name == "posix": # Andreas Degert's find functions, using gcc, /sbin/ldconfig, objdump - import re, tempfile, errno + import re, tempfile, errno, subprocess def _findLib_gcc(name): + devnull = file(os.devnull, "r+") expr = r'[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name) fdout, ccout = tempfile.mkstemp() os.close(fdout) cmd = 'if type gcc >/dev/null 2>&1; then CC=gcc; elif type cc >/dev/null 2>&1; then CC=cc;else exit 10; fi;' \ '$CC -Wl,-t -o ' + ccout + ' 2>&1 -l' + name try: - f = os.popen(cmd) - trace = f.read() - rv = f.close() + p = subprocess.Popen(cmd, shell=True, + stdout=subprocess.PIPE, stderr=devnull) + trace = p.communicate()[0] finally: try: os.unlink(ccout)