Ticket #9808: trac_9808-numpy.patch

File trac_9808-numpy.patch, 4.9 KB (added by jhpalmieri, 11 years ago)

for reference only: diff between old numpy 1.5.0 spkg and new one

  • SPKG.txt

    # HG changeset patch
    # User J. H. Palmieri <palmieri@math.washington.edu>
    # Date 1286403167 25200
    # Node ID 27be723ed2c381e097a3f13fe98572d4bb54273d
    # Parent  f25c73a249c4e3f24043a60d04af7ba730688829
    Fix a bug when building on Solaris: numpy was not built with c99, but
    used isfinite, which is only defined in c99 on Solaris.  See Sage trac
    ticket #9808 and numpy trac ticket #1625
    (http://projects.scipy.org/numpy/ticket/1625).  To fix, apply the
    patch from numpy trac ticket #1625, patching src/numpy/core/setup.py
    and src/numpy/distutils/command/config.py.  When numpy 1.5.1 is
    released, check to see if these patches are still necessary.
    
    Also, in spkg-install, export F77, F90, and F95 to make sure that
    packages which use numpy (like scipy and scipy_sandbox) use the
    correct Fortran.
    
    diff -r f25c73a249c4 -r 27be723ed2c3 SPKG.txt
    a b  
    5959
    6060== Changelog ==
    6161
    62 ===
     62=== numpy-1.5.0 (John Palmieri, 5 October 2010) ==
     63 * Fix a bug when building on Solaris: numpy was not built with c99,
     64   but used isfinite, which is only defined in c99 on Solaris.  See
     65   Sage trac ticket #9808 and numpy trac ticket #1625
     66   (http://projects.scipy.org/numpy/ticket/1625).  To fix, apply
     67   the patch from numpy trac ticket #1625, patching
     68   src/numpy/core/setup.py and src/numpy/distutils/command/config.py.
     69   When numpy 1.5.1 is released, check to see if these patches are
     70   still necessary.
     71 * In spkg-install, export F77, F90, and F95 to make sure that
     72   packages which use numpy (like scipy and scipy_sandbox) use the
     73   correct Fortran.
    6374
    64 === === numpy-1.4.1 (Stefan Reiterer, 4 September 2010) ==
     75=== numpy-1.5.0 (Stefan Reiterer, 4 September 2010) ==
    6576 * Update to numpy-1.5.0
    6677 * numpy/core/src/multiarray/buffer.c has to be patched
    6778   (see on numpy trac ticket #1605)
  • new file patches/config.py.patch

    diff -r f25c73a249c4 -r 27be723ed2c3 patches/config.py.patch
    - +  
     1--- ../src/numpy/distutils/command/config.py    2010-08-22 01:08:35.000000000 -0400
     2+++ config.py   2010-10-05 22:29:12.711678000 -0400
     3@@ -169,6 +169,22 @@
     4 
     5         return self.try_compile(body, headers, include_dirs)
     6 
     7+    def check_macro_true(self, symbol,
     8+                         headers=None, include_dirs=None):
     9+        self._check_compiler()
     10+        body = """
     11+int main()
     12+{
     13+#if %s
     14+#else
     15+#error false or undefined macro
     16+#endif
     17+    ;
     18+    return 0;
     19+}""" % (symbol,)
     20+
     21+        return self.try_compile(body, headers, include_dirs)
     22+
     23     def check_type(self, type_name, headers=None, include_dirs=None,
     24             library_dirs=None):
     25         """Check type availability. Return True if the type can be compiled,
  • new file patches/setup.py.patch

    diff -r f25c73a249c4 -r 27be723ed2c3 patches/setup.py.patch
    - +  
     1--- ../src/numpy/core/setup.py  2010-08-25 08:32:15.000000000 -0400
     2+++ setup.py    2010-10-05 22:29:44.475225000 -0400
     3@@ -215,12 +215,15 @@
     4     _macros = ["isnan", "isinf", "signbit", "isfinite"]
     5     if sys.version_info[:2] >= (2, 6):
     6         for f in _macros:
     7-            st = config.check_decl(fname2def("decl_%s" % f),
     8+            py_symbol = fname2def("decl_%s" % f)
     9+            already_declared = config.check_decl(py_symbol,
     10                     headers=["Python.h", "math.h"])
     11-            if not st:
     12-                macros.append(f)
     13+            if already_declared:
     14+                if config.check_macro_true(py_symbol,
     15+                        headers=["Python.h", "math.h"]):
     16+                    pub.append('NPY_%s' % fname2def("decl_%s" % f))
     17             else:
     18-                _add_decl(f)
     19+                macros.append(f)
     20     else:
     21         macros = _macros[:]
     22     # Normally, isnan and isinf are macro (C99), but some platforms only have
  • spkg-install

    diff -r f25c73a249c4 -r 27be723ed2c3 spkg-install
    a b  
    3737    unset ATLAS
    3838    unset BLAS
    3939    unset LAPACK
    40     export FC="sage_fortran"
    4140else
    4241    export LDFLAGS="${LDFLAGS} -shared"
    4342fi
    4443export FC="${SAGE_LOCAL}/bin/sage_fortran"
     44export F77="${SAGE_LOCAL}/bin/sage_fortran"
     45export F90="${SAGE_LOCAL}/bin/sage_fortran"
     46export F95="${SAGE_LOCAL}/bin/sage_fortran"
    4547export NUMPY_FCONFIG="config_fc --noopt --noarch"
    4648
    4749################################################
     
    5052#the real_roots.pyx file of sage.rings.polynomial
    5153cp ../patches/buffer.c numpy/core/src/multiarray/buffer.c
    5254
     55# Patches to fix problems reported at #9808.  When numpy 1.5.1 is
     56# released, check to see if these patches are still necessary.
     57cp ../patches/setup.py numpy/core/setup.py
     58cp ../patches/config.py numpy/distutils/command/config.py
     59
    5360rm -rf "$SAGE_LOCAL"/lib/python/site-packages/numpy
    5461
    5562# Program around a bug in SciPY's distutils.