Exemple #1
0
    def swig_sources(self, sources, extension):
        """swig these days generates a shadow module, but distutils doesn't
        know about it.

        This (rather crude) build_ext subclass copies the shadow python
        module into their package, assuming standard package layout.
        
        It also defines a pre_swig_hook that is called immediately before
        swig is called.
        
        It doesn't support more than one .i file per extension.
        """
        self.pre_swig_hook(sources, extension)
        
        sources = build_ext.swig_sources(self, sources, extension)
        package_parts = extension.name.split('.')
        module = package_parts.pop()
        if module[0] != '_':
            log.warn('SWIG extensions must start with an underscore')
            return
        # strip underscore
        module = module[1:]
        if package_parts:
            log.warn("cp %s %s", module +'.py', os.path.join(*package_parts))
            shutil.copy(module +'.py', os.path.join(*package_parts))

        return sources
Exemple #2
0
    def swig_sources( self, sources, ext ):
        import re
        # Make sure we have an appropriate version of
        # SWIG
        log.info( "Checking for swig version >= %i.%i.%i ..." % required_swig_version )
        swig = self.swig or self.find_swig()
        temp_swig_out = subprocess.Popen([swig, '-version'],
                                          stdout=subprocess.PIPE).communicate()[0]
        temp_swig_out = re.search(".*SWIG Version ([\.0-9]*).*", temp_swig_out).group(1)
        swig_version = tuple([int(num) for num in temp_swig_out.split('.')])
        if swig_version >= required_swig_version:
            log.info("yes")
        else:
            log.info("no")
            log.error("""
  Suggested SWIG version not found (version %i.%i.%i found).  
  This will result in python bindings with reduced funcationalities,
  in particular the inability to access protected class members in
  derived python classes. If this functionality is not needed,
  then ignore this message. 

  One can point the setup to an appropriate swig using 
  the build_ext option '--swig'.  For example, type both 
  
 >python setup.py build_ext --swig=/path/to/swig 
 >python setup.py build
  
  *NOTE*: This warning is expected on SLAC machines as the distributed
  swig version is less than required.  Please try running the  
  command first:

 >python setup.py build_ext --swig=/u/xo/mgmarino/software/bin/swig

  which should use the correct swig. 
  
  As always, be sure to test the installation with

 >python test.py

  after completion!
                  """ % swig_version)
        return build_ext.swig_sources(self, sources, ext)
 def swig_sources(self, sources, *otherargs):
     # first do any Pyrex processing
     sources = _build_ext.swig_sources(self, sources) or sources
     # Then do any actual SWIG stuff on the remainder
     return _du_build_ext.swig_sources(self, sources, *otherargs)
 def swig_sources(self, sources, *otherargs):
     sources = _build_ext.swig_sources(self, sources) or sources
     return _du_build_ext.swig_sources(self, sources, *otherargs)
 def swig_sources(self, sources, *otherargs):
     # first do any Pyrex processing
     sources = _build_ext.swig_sources(self, sources) or sources
     # Then do any actual SWIG stuff on the remainder
     return _du_build_ext.swig_sources(self, sources, *otherargs)
Exemple #6
0
 def swig_sources (self, sources, extension):
     return [unvpath(src) for src in
             _build_ext.swig_sources(self, sources, extension)]
Exemple #7
0
 def swig_sources(self, sources, extension):
     return [
         unvpath(src)
         for src in _build_ext.swig_sources(self, sources, extension)
     ]