In Clawpack, we use numpy.distutils to handle compilation and wrapping of
Fortran source files via f2py.  This generates a huge amount of output
(warnings generated by f2py in intermediate steps) that (it seems) can
safely be ignored.  However, it's problematic to have pages of warnings fly
by whenever a user installs the package.  I would like to redirect this
output to a log file.

I have tried adding

    sys.stdout = open('install.log', 'w')

in the setup.py file.  This redirects some of the output, but not all of
it.  Below I've pasted an example of output that still prints to the
terminal.  How can I force all of this output to go into a log file and not
be printed to the screen?

An example setup.py file is here:
https://github.com/clawpack/pyclaw/blob/master/src/pyclaw/setup.py

Some example output that I can't redirect is here:

    In file included from
> build/src.macosx-10.5-x86_64-2.7/clawpack/riemann/euler_4wave_2Dmodule.c:18:
>
>     In file included from
> build/src.macosx-10.5-x86_64-2.7/fortranobject.h:13:
>
>     In file included from
> /Users/ketch/anaconda/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:15:
>
>     In file included from
> /Users/ketch/anaconda/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:17:
>
>     In file included from
> /Users/ketch/anaconda/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1728:
>
>
> /Users/ketch/anaconda/lib/python2.7/site-packages/numpy/core/include/numpy/npy_deprecated_api.h:11:2:
> warning: "Using deprecated NumPy API, disable it by #defining
> NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
>
>     #warning "Using deprecated NumPy API, disable it by #defining
> NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION"
>
>      ^
>
>
> build/src.macosx-10.5-x86_64-2.7/clawpack/riemann/euler_4wave_2Dmodule.c:111:12:
> warning: unused function 'f2py_size' [-Wunused-function]
>
>     static int f2py_size(PyArrayObject* var, ...)
>
>                ^
>
>     2 warnings generated.
>
>     clawpack/riemann/src/rpn2_euler_4wave.f90:2.59:
>
>
>
>     subroutine
> rpn2(ixy,maxm,meqn,mwaves,maux,mbc,mx,ql,qr,auxl,auxr,wave,s,amdq,ap
>
>                                                                1
>
>     Warning: Unused dummy argument 'auxl' at (1)
>
>     clawpack/riemann/src/rpn2_euler_4wave.f90:2.64:
>
>
>
>     subroutine
> rpn2(ixy,maxm,meqn,mwaves,maux,mbc,mx,ql,qr,auxl,auxr,wave,s,amdq,ap
>
>                                                                     1
>     Warning: Unused dummy argument 'auxr' at (1)
>

There is a LOT more of it, of course.
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to