[Distutils] -I paths and ext_modules

Greg Ward gward@python.net
Fri, 2 Jun 2000 20:53:21 -0400


On 02 June 2000, Randall Hopper said:
> I need to get a -I path on the cc command line (and a -L/-rpath on the
> linker line).  Is there a way to do this with the current version (portably
> or UNIX-specific; either one)?

Just put 'include_dirs' and 'library_dirs' elements in dictionaries at
the bottom of the 'ext_modules' list-of-tuples-of-dictionaries.  Eg. see 
examples/mxdatetime_setup.py:

       ext_modules = [('DateTime.mxDateTime.mxDateTime',
                       { 'sources': ['mxDateTime/mxDateTime.c'],
                         'include_dirs': ['mxDateTime'],
                       }
                     )]

'library_dirs' is similar.

Note that this is a lot less hairy in the current CVS code:

       ext_modules = [Extension('DateTime.mxDateTime.mxDateTime',
                                ['mxDateTime/mxDateTime.c'],
                                include_dirs=['mxDateTime']
                               )
                     ]
And if this is a setting that users have to override (eg. "specify the
include directories for libfoo here"), the config file code in the
current CVS will handly this nicely.

Right, enough screwing around -- definitely time to write some docs and
tests and get 0.9 out the door.

        Greg
-- 
Greg Ward - just another /P(erl|ython)/ hacker          gward@python.net
http://starship.python.net/~gward/
Budget's in the red?  Let's tax religion!
    -- Dead Kennedys