[Scipy-svn] r3323 - trunk/scipy/io/nifti

scipy-svn@scip... scipy-svn@scip...
Tue Sep 18 15:35:29 CDT 2007


Author: matthew.brett@gmail.com
Date: 2007-09-18 15:35:23 -0500 (Tue, 18 Sep 2007)
New Revision: 3323

Modified:
   trunk/scipy/io/nifti/.setup.py.swp
   trunk/scipy/io/nifti/setup.py
Log:
build nifticlib libs

Modified: trunk/scipy/io/nifti/.setup.py.swp
===================================================================
(Binary files differ)

Modified: trunk/scipy/io/nifti/setup.py
===================================================================
--- trunk/scipy/io/nifti/setup.py	2007-09-18 20:19:02 UTC (rev 3322)
+++ trunk/scipy/io/nifti/setup.py	2007-09-18 20:35:23 UTC (rev 3323)
@@ -1,7 +1,18 @@
 #!/usr/bin/env python
-from os.path import join
+import os
+from os.path import isfile, join, dirname
 import sys
+import numpy
 
+nifti_wrapper_file = join('nifti', 'nifticlib.py')
+
+# create an empty file to workaround crappy swig wrapper installation
+if not isfile(nifti_wrapper_file):
+    open(nifti_wrapper_file, 'w')
+
+# find numpy headers
+numpy_headers = join(dirname(numpy.__file__),'core','include')
+
 def configuration(parent_package='',top_path=None):
     from numpy.distutils.misc_util import Configuration
     from numpy.distutils.system_info import get_info
@@ -9,18 +20,26 @@
     config = Configuration('nifti',parent_package,top_path)
     #config.add_data_dir('tests')
 
-    include_dirs = ['.']
+    include_dirs = [
+      '.',
+      './nifticlib/fsliolib',
+      './nifticlib/niftilib',
+      './nifticlib/znzlib']
 
     # Libraries
-    config.add_library('fslio', sources=['fslio.c'], include_dirs=include_dirs)
-    config.add_library('niftiio', sources=['nifti1_io.c'], include_dirs=include_dirs)
-    config.add_library('znz', sources=['znzlib.c'], include_dirs=include_dirs)
+    config.add_library('fslio',
+      sources=['./nifticlib/fsliolib/fslio.c'], include_dirs=include_dirs)
+    config.add_library('niftiio',
+      sources=['./nifticlib/niftilib/nifti1_io.c'], include_dirs=include_dirs)
+    config.add_library('znz',
+      sources=['./nifticlib/znzlib/znzlib.c'], include_dirs=include_dirs)
 
     # Extension
     config.add_extension('_nifticlib',
-      sources = ['nifticlib_wrap.c'],
-      include_dirs=include_dirs,
-      libraries = ['niftiio', 'fslio', 'znz',])
+      sources = ['nifticlib.i', 'nifticlib_wrap.c'],
+      include_dirs = include_dirs,
+      libraries = ['niftiio', 'fslio', 'znz',],
+      swig_opts = ['-I/usr/include/nifti', '-I'+numpy_headers])
 
     return config
 



More information about the Scipy-svn mailing list