[Numpy-svn] r5461 - in branches/1.1.x/numpy: core distutils random

numpy-svn at scipy.org numpy-svn at scipy.org
Sun Jul 20 01:49:35 EDT 2008


Author: charris
Date: 2008-07-20 00:49:31 -0500 (Sun, 20 Jul 2008)
New Revision: 5461

Modified:
   branches/1.1.x/numpy/core/setup.py
   branches/1.1.x/numpy/distutils/misc_util.py
   branches/1.1.x/numpy/random/setup.py
Log:
Backport r5452 build fixes.


Modified: branches/1.1.x/numpy/core/setup.py
===================================================================
--- branches/1.1.x/numpy/core/setup.py	2008-07-20 02:16:34 UTC (rev 5460)
+++ branches/1.1.x/numpy/core/setup.py	2008-07-20 05:49:31 UTC (rev 5461)
@@ -65,7 +65,10 @@
     header_dir = 'include/numpy' # this is relative to config.path_in_package
 
     def generate_config_h(ext, build_dir):
-        target = join(build_dir,'config.h')
+        target = join(build_dir,header_dir,'config.h')
+        dir = os.path.dirname(target)
+        if not os.path.exists(dir):
+            os.makedirs(dir)
         if newer(__file__,target):
             config_cmd = config.get_config_cmd()
             log.info('Generating %s',target)
@@ -159,7 +162,10 @@
 
     def generate_numpyconfig_h(ext, build_dir):
         """Depends on config.h: generate_config_h has to be called before !"""
-        target = join(build_dir,'numpyconfig.h')
+        target = join(build_dir,header_dir,'numpyconfig.h')
+        dir = os.path.dirname(target)
+        if not os.path.exists(dir):
+            os.makedirs(dir)
         if newer(__file__,target):
             config_cmd = config.get_config_cmd()
             log.info('Generating %s',target)
@@ -198,7 +204,7 @@
             try:
                 m = __import__(module_name)
                 log.info('executing %s', script)
-                h_file, c_file, doc_file = m.generate_api(build_dir)
+                h_file, c_file, doc_file = m.generate_api(os.path.join(build_dir, header_dir))
             finally:
                 del sys.path[0]
             config.add_data_files((header_dir, h_file),
@@ -210,7 +216,10 @@
     generate_ufunc_api = generate_api_func('generate_ufunc_api')
 
     def generate_umath_c(ext,build_dir):
-        target = join(build_dir,'__umath_generated.c')
+        target = join(build_dir,header_dir,'__umath_generated.c')
+        dir = os.path.dirname(target)
+        if not os.path.exists(dir):
+            os.makedirs(dir)
         script = generate_umath_py
         if newer(script,target):
             f = open(target,'w')

Modified: branches/1.1.x/numpy/distutils/misc_util.py
===================================================================
--- branches/1.1.x/numpy/distutils/misc_util.py	2008-07-20 02:16:34 UTC (rev 5460)
+++ branches/1.1.x/numpy/distutils/misc_util.py	2008-07-20 05:49:31 UTC (rev 5461)
@@ -114,9 +114,20 @@
 def get_mathlibs(path=None):
     """Return the MATHLIB line from numpyconfig.h
     """
-    if path is None:
-        path = os.path.join(get_numpy_include_dirs()[0], 'numpy')
-    config_file = os.path.join(path,'numpyconfig.h')
+    if path is not None:
+        config_file = os.path.join(path,'numpyconfig.h')
+    else:
+        # Look for the file in each of the numpy include directories.
+        dirs = get_numpy_include_dirs()
+        for path in dirs:
+            fn = os.path.join(path,'numpyconfig.h')
+            if os.path.exists(fn):
+                config_file = fn
+                break
+        else:
+            raise DistutilsError('numpyconfig.h not found in numpy include '
+                'dirs %r' % (dirs,))
+
     fid = open(config_file)
     mathlibs = []
     s = '#define MATHLIB'

Modified: branches/1.1.x/numpy/random/setup.py
===================================================================
--- branches/1.1.x/numpy/random/setup.py	2008-07-20 02:16:34 UTC (rev 5460)
+++ branches/1.1.x/numpy/random/setup.py	2008-07-20 05:49:31 UTC (rev 5461)
@@ -6,11 +6,7 @@
 
     def generate_libraries(ext, build_dir):
         config_cmd = config.get_config_cmd()
-        if top_path is None:
-            libs = get_mathlibs()
-        else:
-            path = join(split(build_dir)[0],'core')
-            libs = get_mathlibs(path)
+        libs = get_mathlibs()
         tc = testcode_wincrypt()
         if config_cmd.try_run(tc):
             libs.append('Advapi32')




More information about the Numpy-svn mailing list