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

scipy-svn@scip... scipy-svn@scip...
Thu Oct 4 00:46:20 CDT 2007


Author: jarrod.millman
Date: 2007-10-04 00:46:17 -0500 (Thu, 04 Oct 2007)
New Revision: 3401

Modified:
   trunk/scipy/io/nifti/setup.py
Log:
update setup.py to conform with SciPy


Modified: trunk/scipy/io/nifti/setup.py
===================================================================
--- trunk/scipy/io/nifti/setup.py	2007-10-04 05:30:09 UTC (rev 3400)
+++ trunk/scipy/io/nifti/setup.py	2007-10-04 05:46:17 UTC (rev 3401)
@@ -1,55 +1,51 @@
 #!/usr/bin/env python
-
-### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###
-#
-#    Python distutils setup for PyNifti
-#
-#    Copyright (C) 2006-2007 by
-#    Michael Hanke <michael.hanke@gmail.com>
-#
-#    This is free software; you can redistribute it and/or
-#    modify it under the terms of the MIT License.
-#
-#    This package is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the COPYING
-#    file that comes with this package for more details.
-#
-### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###
-
-from distutils.core import setup, Extension
 import os
+from os.path import isfile, join, dirname
+import sys
 import numpy
-from glob import glob
 
-nifti_wrapper_file = os.path.join('nifti', 'nifticlib.py')
+nifti_wrapper_file = join('nifticlib.py')
 
 # create an empty file to workaround crappy swig wrapper installation
-if not os.path.isfile(nifti_wrapper_file):
+if not isfile(nifti_wrapper_file):
     open(nifti_wrapper_file, 'w')
 
 # find numpy headers
-numpy_headers = os.path.join(os.path.dirname(numpy.__file__),'core','include')
+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
 
-# Notes on the setup
-# Version scheme is:
-# 0.<4-digit-year><2-digit-month><2-digit-day>.<ever-increasing-integer>
+    config = Configuration('nifti',parent_package,top_path)
+    config.add_data_dir('tests')
 
-setup(name       = 'pynifti',
-    version      = '0.20070930.1',
-    author       = 'Michael Hanke',
-    author_email = 'michael.hanke@gmail.com',
-    license      = 'MIT License',
-    url          = 'http://apsy.gse.uni-magdeburg.de/hanke',
-    description  = 'Python interface for the NIfTI IO libraries',
-    long_description = """ """,
-    packages     = [ 'nifti' ],
-    scripts      = glob( 'bin/*' ),
-    ext_modules  = [ Extension( 'nifti._nifticlib', [ 'nifti/nifticlib.i' ],
-            include_dirs = [ '/usr/include/nifti', numpy_headers ],
-            libraries    = [ 'niftiio' ],
-            swig_opts    = [ '-I/usr/include/nifti',
-                             '-I' + numpy_headers ] ) ]
-    )
+    include_dirs = [
+      '.',
+      './nifticlib/fsliolib',
+      './nifticlib/niftilib',
+      './nifticlib/znzlib']
 
+    nifticlib_headers = ' -I'.join(include_dirs)
+    swig_opts = ['-I'+nifticlib_headers, '-I'+numpy_headers]
+
+    # Libraries
+    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.i'],
+      include_dirs = include_dirs,
+      libraries = ['niftiio', 'fslio', 'znz',],
+      swig_opts = swig_opts)
+
+    return config
+
+if __name__ == '__main__':
+    from numpy.distutils.core import setup
+    setup(**configuration(top_path='').todict())



More information about the Scipy-svn mailing list