[Python-bugs-list] [ python-Bugs-620630 ] distutils mixed stdin/stdout output

noreply@sourceforge.net noreply@sourceforge.net
Mon, 04 Nov 2002 06:29:04 -0800

Bugs item #620630, was opened at 2002-10-09 02:50
You can respond by visiting: 

Category: Distutils
Group: Python 2.3
Status: Open
Resolution: None
Priority: 3
Submitted By: Matthias Klose (doko)
>Assigned to: A.M. Kuchling (akuchling)
Summary: distutils mixed stdin/stdout output

Initial Comment:
If distutils output is piped to a common logfile, the
output is garbled as shown in:


It's a bit confusing to search errors in the garbled
output. It would be nice, if distutils flashes the
output buffers on each newline.

Not sure how well this shows in the included snippets.

gcc-3.2 -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC
-IInclude -IPackages/FFSrc/ranlibmodule.c: In function
[here in the middle of the line]
Src/ranlibmodule.c:47: warning: function declaration
isn't a prototype

Src/lapack_litemodule.c:649: warning:
`lapack_liteError' defined but not used
[upto here a compile command, then two other commands
succeed, then the error for the link command]
/usr/bin/ld: cannot find -lg2c-pic
collect2: ld returned 1 exit status

[and now the link command:]
gcc-3.2 -shared
build/temp.linux-ppc-2.3/lapack_litemodule.o -llapack
-lblas -lg2c-pic -o build/lib.linux-ppc-2.3/lapack_lite.so
error: command 'gcc-3.2' failed with exit status 1


>Comment By: A.M. Kuchling (akuchling)
Date: 2002-11-04 09:29

Logged In: YES 

Attached is an example of bad output, producing by compiling Numeric
with "python setup.py build >out 2>&1".  The compiler error messages come first, followed by the distutils 'Building multiarray extension' message.

Jeremy's logging reorganization makes a fix simple; just add  
sys.stdout.flush() to Log._log() in distutils/log.py.  Checked in as revision 1.2 of log.py.  Matthis, does that fix your problem?


Comment By: Guido van Rossum (gvanrossum)
Date: 2002-10-14 20:51

Logged In: YES 

The only way to turn on unbuffered output is to use python -u...

I can't interpret the output you quote above; and the word
"ranlibmodule.c" doesn't occur on the URL you mention; so
I'm not sure what the relationship between the two is.

I know very little of distutils. It seems it uses spawn() to
run subcommands, which uses fork+exec. The buffering set by
distutils for itself doesn't affect the buffering of the

Perhaps you could suggest a patch?


Comment By: Matthias Klose (doko)
Date: 2002-10-12 03:44

Logged In: YES 

Sure, but then I'll have to change the packaging of about
100 python packages for Debian. The distutils docs talk
about "python setup.py", not "python -u setup.py". Can
distutils  turn on unbuffered output by default? Is there a
real performance penalty using distutils with unbuffered output?


Comment By: Jeremy Hylton (jhylton)
Date: 2002-10-11 12:16

Logged In: YES 

If you're piping the output to a combined log file, you can
use python -u to unbuffer stdout.


You can respond by visiting: