[Scipy-svn] r4375 - in branches/refactor_fft/scipy/fftpack/backends: . fftw fftw3 mkl

scipy-svn at scipy.org scipy-svn at scipy.org
Sun May 18 06:52:56 EDT 2008


Author: cdavid
Date: 2008-05-18 05:52:48 -0500 (Sun, 18 May 2008)
New Revision: 4375

Modified:
   branches/refactor_fft/scipy/fftpack/backends/fftw/setup.py
   branches/refactor_fft/scipy/fftpack/backends/fftw3/setup.py
   branches/refactor_fft/scipy/fftpack/backends/mkl/setup.py
   branches/refactor_fft/scipy/fftpack/backends/setup.py
Log:
Build extensions in backend dir instead of building in each backend.

Modified: branches/refactor_fft/scipy/fftpack/backends/fftw/setup.py
===================================================================
--- branches/refactor_fft/scipy/fftpack/backends/fftw/setup.py	2008-05-18 09:42:27 UTC (rev 4374)
+++ branches/refactor_fft/scipy/fftpack/backends/fftw/setup.py	2008-05-18 10:52:48 UTC (rev 4375)
@@ -1,25 +1,10 @@
 #!/usr/bin/env python
 # Created by Pearu Peterson, August 2002
 
-from os.path import join
-
-def build_backends(config):
-    from numpy.distutils.system_info import get_info
-    src = [join('src', i) for i in 
-                             ['zfft.cxx', 'drfft.cxx', 'zfftnd.cxx']]
-    info = get_info("fftw2")
-    if info:
-        config.add_library("fftw_backend",
-                           sources = src,
-                           include_dirs = ["../common",
-                                           info['include_dirs']])
-        config.add_extension("_fftw", sources = ["fftw.pyf"], extra_info = info, libraries = ["fftw_backend"])
-    
 def configuration(parent_package='',top_path=None):
     from numpy.distutils.misc_util import Configuration
 
     config = Configuration('fftw', parent_package, top_path)
-    build_backends(config)
 
     return config
 

Modified: branches/refactor_fft/scipy/fftpack/backends/fftw3/setup.py
===================================================================
--- branches/refactor_fft/scipy/fftpack/backends/fftw3/setup.py	2008-05-18 09:42:27 UTC (rev 4374)
+++ branches/refactor_fft/scipy/fftpack/backends/fftw3/setup.py	2008-05-18 10:52:48 UTC (rev 4375)
@@ -1,25 +1,10 @@
 #!/usr/bin/env python
 # Created by Pearu Peterson, August 2002
 
-from os.path import join
-
-def build_backends(config):
-    from numpy.distutils.system_info import get_info
-    src = [join('src', i) for i in 
-                             ['zfft.cxx', 'drfft.cxx', 'zfftnd.cxx']]
-    info = get_info("fftw3")
-    if info:
-        config.add_library("fftw3_backend",
-                           sources = src,
-                           include_dirs = ["../common",
-                                           info['include_dirs']])
-        config.add_extension("_fftw3", sources = ["fftw3.pyf"], extra_info = info, libraries = ["fftw3_backend"])
-    
 def configuration(parent_package='',top_path=None):
     from numpy.distutils.misc_util import Configuration
 
     config = Configuration('fftw3', parent_package, top_path)
-    build_backends(config)
 
     return config
 

Modified: branches/refactor_fft/scipy/fftpack/backends/mkl/setup.py
===================================================================
--- branches/refactor_fft/scipy/fftpack/backends/mkl/setup.py	2008-05-18 09:42:27 UTC (rev 4374)
+++ branches/refactor_fft/scipy/fftpack/backends/mkl/setup.py	2008-05-18 10:52:48 UTC (rev 4375)
@@ -1,25 +1,10 @@
 #!/usr/bin/env python
 # Created by Pearu Peterson, August 2002
 
-from os.path import join
-
-def build_backends(config):
-    from numpy.distutils.system_info import get_info
-    src = [join('src', i) for i in 
-                             ['zfft.cxx', 'zfftnd.cxx']]
-    info = get_info("mkl")
-    if info:
-        config.add_library("mkl_backend",
-                           sources = src,
-                           include_dirs = ["../common",
-                                           info['include_dirs']])
-        config.add_extension("_mkl", sources = ["mkl.pyf"], extra_info = info, libraries = ["mkl_backend"])
-    
 def configuration(parent_package='',top_path=None):
     from numpy.distutils.misc_util import Configuration
 
     config = Configuration('mkl', parent_package, top_path)
-    build_backends(config)
 
     return config
 

Modified: branches/refactor_fft/scipy/fftpack/backends/setup.py
===================================================================
--- branches/refactor_fft/scipy/fftpack/backends/setup.py	2008-05-18 09:42:27 UTC (rev 4374)
+++ branches/refactor_fft/scipy/fftpack/backends/setup.py	2008-05-18 10:52:48 UTC (rev 4375)
@@ -1,15 +1,43 @@
 #!/usr/bin/env python
-# Created by Pearu Peterson, August 2002
-
 from os.path import join
 
+from numpy.distutils.system_info import get_info
+
+SRC = {}
+SRC['fftw'] = [join('fftw/src', i) for i in 
+                   ['zfft.cxx', 'drfft.cxx', 'zfftnd.cxx']]
+SRC['fftw3'] = [join('fftw3/src', i) for i in 
+                ['zfft.cxx', 'drfft.cxx', 'zfftnd.cxx']]
+SRC['mkl'] = [join('mkl/src', i) for i in 
+                ['zfft.cxx', 'zfftnd.cxx']]
+
+def build_backend(config, name, config_name = None):
+    if config_name is None:
+        config_name = name
+
+    info = get_info(config_name)
+    if info:
+        config.add_library("%s_backend" % name,
+                           sources = SRC[name],
+                           include_dirs = ["common",
+                                           info['include_dirs']])
+        config.add_extension("%s._%s" % (name, name), 
+                sources = ["%s/%s.pyf" % (name, name)], 
+                extra_info = info, libraries = ["%s_backend" % name])
+
+    config.add_subpackage(name)
+
 def configuration(parent_package='',top_path=None):
     from numpy.distutils.misc_util import Configuration
     config = Configuration('backends', parent_package, top_path)
         
-    config.add_subpackage("fftw3")
-    config.add_subpackage("fftw")
-    config.add_subpackage("mkl")
+    # It is a bit of an hack: we build the extensions here, but we add
+    # subpackages. The reason why we build the extensions here is because we
+    # share files between backends, and scons cannot use sources outside its
+    # top directory.
+    build_backend(config, 'fftw', 'fftw2')
+    build_backend(config, 'fftw3')
+    build_backend(config, 'mkl')
 
     return config
 




More information about the Scipy-svn mailing list