]> Creatis software - gdcm.git/commitdiff
* FIX : distutilsWrapping.py : copy of .lib file for windows systems
authorregrain <regrain>
Thu, 19 Feb 2004 13:16:23 +0000 (13:16 +0000)
committerregrain <regrain>
Thu, 19 Feb 2004 13:16:23 +0000 (13:16 +0000)
   -- BeNours

distutilsWrapping.py

index 96152a9b55fed4534dfde0dc56985aa4c0554db6..e1fbcb09ea937dbdc7ec3f0845bf1b183c0d3152 100644 (file)
@@ -1,7 +1,9 @@
 from distutils.command.build_ext import build_ext
 from distutils.core import Extension
+from distutils.file_util import copy_file
 from types import ListType
 import os
+import string
 
 class build_extWrap(build_ext):
        """
@@ -16,6 +18,26 @@ class build_extWrap(build_ext):
                self.__ext=ext
                build_ext.build_extension(self,ext)
 
+               if(os.name!='posix'):
+                       # Copy the .lib file
+                       fullname = self.get_ext_fullname(ext.name)
+                       modpath = string.split(fullname, '.')
+                       package = string.join(modpath[0:-1], '.')
+                       base = modpath[-1]
+                       if self.inplace:
+                               # ignore build-lib -- put the compiled extension into
+                               # the source tree along with pure Python modules
+                               build_py = self.get_finalized_command('build_py')
+                               package_dir = build_py.get_package_dir(package)
+                               dstLib=package_dir
+                       else:
+                               dstLib=self.build_lib
+       
+                       srcLib=os.path.join(self.build_temp,base+".lib")
+                       dstLib=os.path.join(dstLib,package)
+       
+                       copy_file(srcLib,dstLib)
+
        def swig_sources(self,sources):
                """Walk the list of source files in 'sources',looking for SWIG
                interface(.i) files.  Run SWIG on all that are found,and