[SciPy-user] Problem controlling temp dir usage and verbose output for scipy_distutils vs. distutils

Robert Clewley rclewley at cam.cornell.edu
Thu Sep 29 16:20:02 CDT 2005


Hi,

I've just got scipy_distutils and SWIG to successfully build a C extension 
module that uses Fortran sources (after surprisingly little additional effort 
from the pure-C case -- nice job Pearu), but I'm having trouble with two things 
that I didn't have trouble with using Python's original distutils:

1) Controlling the stderr warnings and info from the compilers

and

2) Controlling the temp directories that the build uses.

The libraries I'm building are numerical ODE integrators which are selected in 
my software by the user. I want to keep the filespace tidy and not require any 
additional admin by the user. In the past I've been building pure C extensions 
and provided arguments to my (regular Python distutils) setup command like the 
following, which solved both of the above problems:

setup(name = "integrator in pure c",
       author = "me",
       script_args = ['-q', 'build', '--build-lib=.', '--build-platlib=.',
                      '-t'+tempdirname],
       ext_modules = [Extension("modC",
                      sources=modfilelist,
                      include_dirs=incdirs,
                      extra_compile_args=['-w'])])

The script args placed all of the temporary files in the same place which is 
automatically chosen by my software according to the user's choice of 
integrator. The -w argument used to shut up the C compiler nicely!

However, when I switched to scipy_distutils in order to access the Fortran 
compiler, these options no longer seem to have any effect. This is what the 
modules that use Fortran libraries are set up with:

setup(name = "integrator with fortran lib",
       author = "me",
       script_args = ['-q', 'build', '--build-lib=.', '--build-platlib=.',
                      '-t'+tempdirname],
       ext_modules = [Extension("modfort",
                      sources=modfilelist,
                      include_dirs=incdirs,
                      libraries=['myfortlib'],
                      extra_compile_args=['-w'])],
       libraries=[('myfortlib',{'sources': fortfilelist})])

I now end up with a deep tree of temp directories (such as I used to have in 
the pure C case before I discovered the --build-lib options) inside my desired 
compilation temporary directory, as well as a separate 'build' directory beside 
my temp compilation dir that holds my final .py interface file (in 
./build/src/modfort_temp/).

I looked at the API and I cannot see additional options that I could be 
passing. I can see a install_libbase attribute being inherited from Python's 
distutils/command/install.py module's install class into SciPy's overriding 
class, but I don't get why it's not being used in the same way. I'm having the 
same problems on both Win32 and Linux platform using Python 2.3.5 and SciPy 
0.3.2. My problem is also not specific to using Fortran libraries, as my old 
pure-C module suffers problem (2) when I use scipy_distutils on it (although 
the compiler stays quiet).

Any ideas please?

Thanks,
Rob Clewley



More information about the SciPy-user mailing list