A few questions about numpy.distutils

David Cournapeau david at ar.media.kyoto-u.ac.jp
Mon Oct 30 03:26:36 EST 2006


Hi there,

   I would like to improve a bit the packaging of pyaudio, and for that, 
I need to do the following when configuring my package:

   - to be able to retrieve a header file (sndfile.h). I need the full 
pathname, because I need to read its content
   - to be able to retrieve a library file. I need the full pathname, 
including the library prefix and suffix/extension,
because I need to load it with ctypes.

    I've shamelessly copied and pasted code from 
numpy.distutils.system_info, and I manage to retrieve informations for 
my library, and to retrieve the full pathname for sndfile.h, but I don't 
know how to get the full shared library file. For now, my sndfile_info 
looks like that:

class sndfile_info(system_info):
   #variables to override
   section         = 'sndfile'
   notfounderror   = SndfileNotFoundError
   libname         = 'sndfile'
   header          = 'sndfile.h'

   def __init__(self):
       
system_info.__init__(self)                                                       

    
   def calc_info(self):
       """ Compute the informations of the library """

       # Look for the shared library
       sndfile_libs    = self.get_libs('sndfile_libs', self.libname)
       lib_dirs        = self.get_lib_dirs()
       for i in lib_dirs:
           tmp = self.check_libs(i, sndfile_libs)
           if tmp is not None:
               info    = tmp
               break
       else:
           return

       # Look for the header file
       include_dirs    = self.get_include_dirs()
       inc_dir         = None
       for d in include_dirs:
           p = self.combine_paths(d,self.header)
           if p:
               inc_dir     = os.path.dirname(p[0])
               headername  = os.path.abspath(p[0])
               break
       if inc_dir is not None:
           dict_append(info, include_dirs=[inc_dir],
                   headername = headername)

       self.set_info(**info)
       return

   Any help to get the full library name would be appreciated (I cannot 
use find_library from ctypes.util, because I have no guarantee that it 
will return the same one than distutils),

   Thanks,

   David

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642




More information about the NumPy-Discussion mailing list