update numpy to 1.16.4

Fixes #327
This commit is contained in:
Mathieu Virbel 2019-09-28 18:06:36 +02:00
parent 49b16c6f0d
commit e58fef85c3
3 changed files with 73 additions and 60 deletions

View file

@ -1,12 +1,13 @@
from toolchain import CythonRecipe
from toolchain import CythonRecipe, shprint
from os.path import join
from os import chdir, listdir
import sh
import shutil
class NumpyRecipe(CythonRecipe):
version = "1.9.1"
url = "https://pypi.python.org/packages/source/n/numpy/numpy-{version}.tar.gz"
version = "1.16.4"
url = "https://pypi.python.org/packages/source/n/numpy/numpy-{version}.zip"
library = "libnumpy.a"
libraries = ["libnpymath.a", "libnpysort.a"]
include_dir = "numpy/core/include"
@ -17,7 +18,7 @@ class NumpyRecipe(CythonRecipe):
def prebuild_arch(self, arch):
if self.has_marker("patched"):
return
self.apply_patch("numpy-1.9.1.patch")
self.apply_patch("numpy-1.16.4.patch")
self.set_marker("patched")
def get_recipe_env(self, arch):
@ -51,4 +52,5 @@ class NumpyRecipe(CythonRecipe):
shutil.rmtree(join(dest_dir, "random", "tests"))
shutil.rmtree(join(dest_dir, "tests"))
recipe = NumpyRecipe()

View file

@ -0,0 +1,67 @@
diff -Naur numpy/core/setup.py numpy-1.16.4/numpy/core/setup.py
--- numpy-1.16.4.orig/numpy/core/setup.py 2019-05-27 12:41:06.000000000 +0200
+++ numpy-1.16.4/numpy/core/setup.py 2019-09-28 12:51:56.000000000 +0200
@@ -757,7 +757,9 @@
join('src', 'common', 'numpyos.c'),
]
- blas_info = get_info('blas_opt', 0)
+ # XXX IOS, no blas available
+ # blas_info = get_info('blas_opt', 0)
+ blas_info = None
if blas_info and ('HAVE_CBLAS', None) in blas_info.get('define_macros', []):
extra_info = blas_info
# These files are also in MANIFEST.in so that they are always in
--- numpy-1.16.4.orig/numpy/linalg/setup.py 2019-02-21 17:33:42.000000000 +0100
+++ numpy-1.16.4/numpy/linalg/setup.py 2019-09-28 17:34:15.000000000 +0200
@@ -38,9 +38,12 @@
return []
return [all_sources[0]]
+ def get_lapack_lite_sources_ios(ext, build_dir):
+ return []
+
config.add_extension(
'lapack_lite',
- sources=['lapack_litemodule.c', get_lapack_lite_sources],
+ sources=['lapack_litemodule.c', get_lapack_lite_sources_ios],
depends=['lapack_lite/f2c.h'],
extra_info=lapack_info,
)
@@ -48,7 +51,7 @@
# umath_linalg module
config.add_extension(
'_umath_linalg',
- sources=['umath_linalg.c.src', get_lapack_lite_sources],
+ sources=['umath_linalg.c.src', get_lapack_lite_sources_ios],
depends=['lapack_lite/f2c.h'],
extra_info=lapack_info,
libraries=['npymath'],
--- numpy-1.16.4.orig/numpy/core/setup.py 2019-09-28 17:41:37.000000000 +0200
+++ numpy-1.16.4/numpy/core/setup.py 2019-09-28 17:41:58.000000000 +0200
@@ -824,7 +824,10 @@
join('include', 'numpy', 'npy_1_7_deprecated_api.h'),
# add library sources as distuils does not consider libraries
# dependencies
- ] + npysort_sources + npymath_sources
+
+ # XXX This breaks for iOS, it results on duplicate symbols
+ # ] + npysort_sources + npymath_sources
+ ] #+ npysort_sources + npymath_sources
multiarray_src = [
join('src', 'multiarray', 'alloc.c'),
--- numpy-1.16.4.orig/numpy/core/setup.py 2019-09-28 17:42:38.000000000 +0200
+++ numpy-1.16.4/numpy/core/setup.py 2019-09-28 17:44:09.000000000 +0200
@@ -926,7 +926,7 @@
config.add_extension('_multiarray_umath',
sources=multiarray_src + umath_src +
- npymath_sources + common_src +
+ common_src +
[generate_config_h,
generate_numpyconfig_h,
generate_numpy_api,

View file

@ -1,56 +0,0 @@
diff -Naur numpy-1.9.1.orig/numpy/core/include/numpy/npy_endian.h numpy-1.9.1.ios/numpy/core/include/numpy/npy_endian.h
--- numpy-1.9.1.orig/numpy/core/include/numpy/npy_endian.h 2014-10-26 15:36:14.000000000 +0100
+++ numpy-1.9.1.ios/numpy/core/include/numpy/npy_endian.h 2014-11-24 01:59:52.000000000 +0100
@@ -6,7 +6,10 @@
* endian.h
*/
-#ifdef NPY_HAVE_ENDIAN_H
+
+//#ifdef NPY_HAVE_ENDIAN_H
+//XXX iOS fix, it detects endian.h, but weird detection happen during the compilation
+#if 0
/* Use endian.h if available */
#include <endian.h>
diff -Naur numpy-1.9.1.orig/numpy/core/setup.py numpy-1.9.1.ios/numpy/core/setup.py
--- numpy-1.9.1.orig/numpy/core/setup.py 2014-10-26 17:22:33.000000000 +0100
+++ numpy-1.9.1.ios/numpy/core/setup.py 2014-11-24 01:58:43.000000000 +0100
@@ -951,6 +951,9 @@
blas_info = get_info('blas_opt', 0)
#blas_info = {}
def get_dotblas_sources(ext, build_dir):
+ # XXX no blas for iOS, maybe it's not needed anymore as our recipe do
+ # BLAS=None
+ return None
if blas_info:
if ('NO_ATLAS_INFO', 1) in blas_info.get('define_macros', []):
return None # dotblas needs ATLAS, Fortran compiled blas will not be sufficient.
diff -Naur numpy-1.9.1.orig/numpy/linalg/setup.py numpy-1.9.1.ios/numpy/linalg/setup.py
--- numpy-1.9.1.orig/numpy/linalg/setup.py 2014-10-26 15:36:15.000000000 +0100
+++ numpy-1.9.1.ios/numpy/linalg/setup.py 2014-11-24 01:57:48.000000000 +0100
@@ -34,8 +34,14 @@
return ext.depends[:1]
return ext.depends[:2]
+ def get_lapack_lite_sources_ios(ext, build_dir):
+ return ext.depends[:-1]
+
+ def get_umath_linalg_ios(ext, build_dir):
+ return ext.depends[:1]
+
config.add_extension('lapack_lite',
- sources = [get_lapack_lite_sources],
+ sources = [get_lapack_lite_sources_ios],
depends = ['lapack_litemodule.c'] + lapack_lite_src,
extra_info = lapack_info
)
@@ -43,7 +49,7 @@
# umath_linalg module
config.add_extension('_umath_linalg',
- sources = [get_lapack_lite_sources],
+ sources = [get_umath_linalg_ios],
depends = ['umath_linalg.c.src'] + lapack_lite_src,
extra_info = lapack_info,
libraries = ['npymath'],