Skip to content

Commit 06b5958

Browse files
authored
Merge pull request kivy#1892 from inclement/update_numpy_1_16_4
Updated numpy recipe to version 1.16.4
2 parents 4b4e899 + d63adf2 commit 06b5958

12 files changed

+111
-94
lines changed

ci/constants.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class TargetPython(Enum):
5656
'websocket-client',
5757
'zeroconf',
5858
'zope',
59+
'matplotlib', # https://github.com/kivy/python-for-android/issues/1900
5960
])
6061
BROKEN_RECIPES_PYTHON3 = set([
6162
'brokenrecipe',
@@ -77,6 +78,7 @@ class TargetPython(Enum):
7778
# mpmath package with a version >= 0.19 required
7879
'sympy',
7980
'vlc',
81+
'matplotlib', # https://github.com/kivy/python-for-android/issues/1900
8082
])
8183

8284
BROKEN_RECIPES = {

pythonforandroid/recipes/matplotlib/mpl_android_fixes.patch

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,26 @@ index fc82d5d..2067db0 100644
44
+++ b/setupext.py
55
@@ -1004,10 +1004,10 @@ class Numpy(SetupPackage):
66
ext.define_macros.append(('__STDC_FORMAT_MACROS', 1))
7-
7+
88
def get_setup_requires(self):
99
- return ['numpy>=1.10.0']
10-
+ return ['numpy==1.15.1'] # to match p4a's target version
11-
10+
+ return ['numpy==1.16.4'] # to match p4a's target version
11+
1212
def get_install_requires(self):
1313
- return ['numpy>=1.10.0']
14-
+ return ['numpy==1.15.1'] # to match p4a's target version
15-
16-
14+
+ return ['numpy==1.16.4'] # to match p4a's target version
15+
16+
1717
class LibAgg(SetupPackage):
1818
@@ -1443,9 +1443,10 @@ class BackendAgg(OptionalBackendPackage):
19-
19+
2020
class BackendTkAgg(OptionalBackendPackage):
2121
name = "tkagg"
2222
- force = True
2323
+ force = False
24-
24+
2525
def check(self):
2626
+ raise CheckFailed("Disabled by patching during Android build") # tk doesn't work on Android but causes build problems
2727
return "installing; run-time loading from Python Tcl / Tk"
28-
28+
2929
def get_extension(self):

pythonforandroid/recipes/numpy/__init__.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,21 @@
55

66
class NumpyRecipe(CompiledComponentsPythonRecipe):
77

8-
version = '1.15.1'
8+
version = '1.16.4'
99
url = 'https://pypi.python.org/packages/source/n/numpy/numpy-{version}.zip'
1010
site_packages_name = 'numpy'
1111
depends = [('python2', 'python3', 'python3crystax')]
1212

1313
patches = [
14-
join('patches', 'fix-numpy.patch'),
15-
join('patches', 'prevent_libs_check.patch'),
14+
join('patches', 'add_libm_explicitly_to_build.patch'),
15+
join('patches', 'do_not_use_system_libs.patch'),
16+
join('patches', 'remove_unittest_call.patch'),
1617
join('patches', 'ar.patch'),
17-
join('patches', 'lib.patch'),
18-
join('patches', 'python-fixes.patch')
19-
]
18+
join('patches', 'fix_setup_dependencies.patch'),
19+
join('patches', 'fix_environment_detection.patch'),
20+
]
21+
22+
call_hostpython_via_targetpython = False
2023

2124
def build_compiled_components(self, arch):
2225
self.setup_extra_args = ['-j', str(cpu_count())]
@@ -52,6 +55,7 @@ def get_recipe_env(self, arch):
5255
env['CC'] += flags
5356
if flags not in env['LD']:
5457
env['LD'] += flags + ' -shared'
58+
5559
return env
5660

5761

pythonforandroid/recipes/numpy/patches/lib.patch renamed to pythonforandroid/recipes/numpy/patches/add_libm_explicitly_to_build.patch

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/numpy/fft/setup.py b/numpy/fft/setup.py
2-
index cd99a82d7..e614ecd07 100644
2+
index cd99a82..cd7c1ef 100644
33
--- a/numpy/fft/setup.py
44
+++ b/numpy/fft/setup.py
55
@@ -9,7 +9,8 @@ def configuration(parent_package='',top_path=None):
@@ -8,12 +8,12 @@ index cd99a82d7..e614ecd07 100644
88
config.add_extension('fftpack_lite',
99
- sources=['fftpack_litemodule.c', 'fftpack.c']
1010
+ sources=['fftpack_litemodule.c', 'fftpack.c'],
11-
+ libraries=['m']
11+
+ libraries=['m'],
1212
)
1313

1414
return config
1515
diff --git a/numpy/linalg/setup.py b/numpy/linalg/setup.py
16-
index 66c07c9e1..d34bd930a 100644
16+
index 66c07c9..d34bd93 100644
1717
--- a/numpy/linalg/setup.py
1818
+++ b/numpy/linalg/setup.py
1919
@@ -43,6 +43,7 @@ def configuration(parent_package='', top_path=None):
@@ -34,10 +34,10 @@ index 66c07c9e1..d34bd930a 100644
3434
return config
3535

3636
diff --git a/numpy/random/setup.py b/numpy/random/setup.py
37-
index 3f3b773a4..c1db9f783 100644
37+
index 394a70e..44af180 100644
3838
--- a/numpy/random/setup.py
3939
+++ b/numpy/random/setup.py
40-
@@ -40,7 +40,7 @@ def configuration(parent_package='',top_path=None):
40+
@@ -39,7 +39,7 @@ def configuration(parent_package='',top_path=None):
4141
if needs_mingw_ftime_workaround():
4242
defs.append(("NPY_NEEDS_MINGW_TIME_WORKAROUND", None))
4343

pythonforandroid/recipes/numpy/patches/ar.patch

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
diff --git a/numpy/core/code_generators/generate_umath.py b/numpy/core/code_generators/generate_umath.py
2-
index 632bcb4..c1e0dd5 100644
2+
index 0fac9b0..94be92a 100644
33
--- a/numpy/core/code_generators/generate_umath.py
44
+++ b/numpy/core/code_generators/generate_umath.py
5-
@@ -970,6 +970,7 @@ def make_arrays(funcdict):
5+
@@ -982,6 +982,7 @@ def make_arrays(funcdict):
66
funclist.append('%s_%s' % (tname, name))
77
if t.simd is not None:
88
for vt in t.simd:
@@ -11,30 +11,27 @@ index 632bcb4..c1e0dd5 100644
1111
#ifdef HAVE_ATTRIBUTE_TARGET_{ISA}
1212
if (npy_cpu_supports("{isa}")) {{
1313
diff --git a/numpy/distutils/ccompiler.py b/numpy/distutils/ccompiler.py
14-
index b03fb96..f9e6cd0 100644
14+
index 14451fa..dfd65da 100644
1515
--- a/numpy/distutils/ccompiler.py
1616
+++ b/numpy/distutils/ccompiler.py
17-
@@ -275,6 +275,7 @@ def CCompiler_compile(self, sources, output_dir=None, macros=None,
17+
@@ -295,6 +295,7 @@ def CCompiler_compile(self, sources, output_dir=None, macros=None,
1818
self._setup_compile(output_dir, macros, include_dirs, sources,
1919
depends, extra_postargs)
2020
cc_args = self._get_cc_args(pp_opts, debug, extra_preargs)
2121
+ cc_args += os.environ['CFLAGS'].split()
2222
display = "compile options: '%s'" % (' '.join(cc_args))
2323
if extra_postargs:
2424
display += "\nextra options: '%s'" % (' '.join(extra_postargs))
25+
@@ -795,4 +796,3 @@ for _cc in ['msvc9', 'msvc', '_msvc', 'bcpp', 'cygwinc', 'emxc', 'unixc']:
26+
_m = sys.modules.get('distutils.' + _cc + 'compiler')
27+
if _m is not None:
28+
setattr(_m, 'gen_lib_options', gen_lib_options)
29+
-
2530
diff --git a/numpy/distutils/unixccompiler.py b/numpy/distutils/unixccompiler.py
26-
index 11b2cce..f6dde79 100644
31+
index 11b2cce..c3e9f10 100644
2732
--- a/numpy/distutils/unixccompiler.py
2833
+++ b/numpy/distutils/unixccompiler.py
29-
@@ -54,6 +54,7 @@ def UnixCCompiler__compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts
30-
deps = []
31-
32-
try:
33-
+ self.linker_so = [os.environ['LD']+" "+os.environ['LDFLAGS']]
34-
self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + deps +
35-
extra_postargs, display = display)
36-
except DistutilsExecError:
37-
@@ -111,6 +112,7 @@ def UnixCCompiler_create_static_lib(self, objects, output_libname,
34+
@@ -111,6 +111,7 @@ def UnixCCompiler_create_static_lib(self, objects, output_libname,
3835
while tmp_objects:
3936
objects = tmp_objects[:50]
4037
tmp_objects = tmp_objects[50:]

pythonforandroid/recipes/numpy/patches/prevent_libs_check.patch renamed to pythonforandroid/recipes/numpy/patches/do_not_use_system_libs.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py
2-
index bea120cf9..a448a83fc 100644
2+
index 806f4f7..0d51cfa 100644
33
--- a/numpy/distutils/system_info.py
44
+++ b/numpy/distutils/system_info.py
5-
@@ -719,6 +719,7 @@ class system_info(object):
5+
@@ -734,6 +734,7 @@ class system_info(object):
66
return self.get_paths(self.section, key)
77

88
def get_libs(self, key, default):
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
commit 9a09edac303c534a38c5d829d8537176f8a8dfb9
2+
Author: Alexander Taylor <alexanderjohntaylor@gmail.com>
3+
Date: Fri Jun 28 22:50:45 2019 +0100
4+
5+
fix_environment_detection.patch
6+
7+
diff --git a/numpy/core/include/numpy/npy_common.h b/numpy/core/include/numpy/npy_common.h
8+
index 64aaaac..e6293f9 100644
9+
--- a/numpy/core/include/numpy/npy_common.h
10+
+++ b/numpy/core/include/numpy/npy_common.h
11+
@@ -164,12 +164,12 @@ extern long long __cdecl _ftelli64(FILE *);
12+
#endif
13+
#else
14+
#ifdef HAVE_FSEEKO
15+
- #define npy_fseek fseeko
16+
+ #define npy_fseek fseek
17+
#else
18+
#define npy_fseek fseek
19+
#endif
20+
#ifdef HAVE_FTELLO
21+
- #define npy_ftell ftello
22+
+ #define npy_ftell ftell
23+
#else
24+
#define npy_ftell ftell
25+
#endif
26+
@@ -321,13 +321,15 @@ typedef unsigned char npy_bool;
27+
#define NPY_TRUE 1
28+
29+
30+
-#if NPY_SIZEOF_LONGDOUBLE == NPY_SIZEOF_DOUBLE
31+
- typedef double npy_longdouble;
32+
- #define NPY_LONGDOUBLE_FMT "g"
33+
-#else
34+
- typedef long double npy_longdouble;
35+
- #define NPY_LONGDOUBLE_FMT "Lg"
36+
-#endif
37+
+/* #if NPY_SIZEOF_LONGDOUBLE == NPY_SIZEOF_DOUBLE */
38+
+/* typedef double npy_longdouble; */
39+
+/* #define NPY_LONGDOUBLE_FMT "g" */
40+
+/* #else */
41+
+/* typedef long double npy_longdouble; */
42+
+/* #define NPY_LONGDOUBLE_FMT "Lg" */
43+
+/* #endif */
44+
+typedef long double npy_longdouble;
45+
+#define NPY_LONGDOUBLE_FMT "Lg"
46+
47+
#ifndef Py_USING_UNICODE
48+
#error Must use Python with unicode enabled.

pythonforandroid/recipes/numpy/patches/python-fixes.patch renamed to pythonforandroid/recipes/numpy/patches/fix_setup_dependencies.patch

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,5 @@
1-
diff --git a/numpy/core/src/multiarray/common.c b/numpy/core/src/multiarray/common.c
2-
index c70f852..695efd5 100644
3-
--- a/numpy/core/src/multiarray/common.c
4-
+++ b/numpy/core/src/multiarray/common.c
5-
@@ -852,3 +852,12 @@ _may_have_objects(PyArray_Descr *dtype)
6-
return (PyDataType_HASFIELDS(base) ||
7-
PyDataType_FLAGCHK(base, NPY_ITEM_HASOBJECT) );
8-
}
9-
+
10-
+/*
11-
+ * Dummy to fix android NDK problem with missing reference.
12-
+ */
13-
+void *
14-
+__emutls_get_address(struct __emutls_object *obj)
15-
+{
16-
+ return NULL;
17-
+}
18-
diff --git a/numpy/distutils/exec_command.py b/numpy/distutils/exec_command.py
19-
index 8118e2f..b586442 100644
20-
--- a/numpy/distutils/exec_command.py
21-
+++ b/numpy/distutils/exec_command.py
22-
@@ -260,7 +260,7 @@ def _exec_command(command, use_shell=None, use_tee = None, **env):
23-
return 127, ''
24-
25-
text, err = proc.communicate()
26-
- text = text.decode(locale.getpreferredencoding(False),
27-
+ text = text.decode('UTF-8',
28-
errors='replace')
29-
30-
text = text.replace('\r\n', '\n')
311
diff --git a/numpy/distutils/misc_util.py b/numpy/distutils/misc_util.py
32-
index f2d677a..758b1ed 100644
2+
index 42374ac..67fcd98 100644
333
--- a/numpy/distutils/misc_util.py
344
+++ b/numpy/distutils/misc_util.py
355
@@ -9,7 +9,6 @@ import atexit
@@ -40,23 +10,24 @@ index f2d677a..758b1ed 100644
4010

4111
import distutils
4212
from distutils.errors import DistutilsError
43-
@@ -93,10 +92,7 @@ def get_num_build_jobs():
13+
@@ -94,11 +93,7 @@ def get_num_build_jobs():
4414

4515
"""
4616
from numpy.distutils.core import get_distribution
4717
- try:
4818
- cpu_count = len(os.sched_getaffinity(0))
4919
- except AttributeError:
5020
- cpu_count = multiprocessing.cpu_count()
21+
- cpu_count = min(cpu_count, 8)
5122
+ cpu_count = 1
5223
envjobs = int(os.environ.get("NPY_NUM_BUILD_JOBS", cpu_count))
5324
dist = get_distribution()
5425
# may be None during configuration
5526
diff --git a/setup.py b/setup.py
56-
index fed178e..b0266eb 100755
27+
index 8b2ded1..431c1b8 100755
5728
--- a/setup.py
5829
+++ b/setup.py
59-
@@ -377,9 +377,8 @@ def setup_package():
30+
@@ -389,9 +389,8 @@ def setup_package():
6031
# Raise errors for unsupported commands, improve help output, etc.
6132
run_build = parse_setuppy_commands()
6233

Original file line numberDiff line numberDiff line change
@@ -1,24 +1,13 @@
11
diff --git a/numpy/testing/__init__.py b/numpy/testing/__init__.py
2-
index a7c8593..007ce26 100644
2+
index a8bd4fc..6b01fa6 100644
33
--- a/numpy/testing/__init__.py
44
+++ b/numpy/testing/__init__.py
5-
@@ -1,22 +1,8 @@
6-
-"""Common test support for all numpy test scripts.
7-
+# fake tester, android don't have unittest
8-
+class Tester(object):
9-
+ def test(self, *args, **kwargs):
10-
+ pass
11-
+ def bench(self, *args, **kwargs):
12-
+ pass
13-
+test = Tester().test
5+
@@ -5,18 +5,11 @@ in a single location, so that test scripts can just import it and work right
6+
away.
147

15-
-This single module should provide all the common functionality for numpy tests
16-
-in a single location, so that test scripts can just import it and work right
17-
-away.
18-
-
19-
-"""
8+
"""
209
-from __future__ import division, absolute_import, print_function
21-
-
10+
2211
-from unittest import TestCase
2312
-
2413
-from ._private.utils import *
@@ -29,6 +18,13 @@ index a7c8593..007ce26 100644
2918
-
3019
-__all__ = _private.utils.__all__ + ['TestCase', 'run_module_suite']
3120
-
32-
-from ._private.pytesttester import PytestTester
21+
-from numpy._pytesttester import PytestTester
3322
-test = PytestTester(__name__)
3423
-del PytestTester
24+
+# fake tester, android don't have unittest
25+
+class Tester(object):
26+
+ def test(self, *args, **kwargs):
27+
+ pass
28+
+ def bench(self, *args, **kwargs):
29+
+ pass
30+
+test = Tester().test

testapps/setup_testapp_python3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
print('packages are', packages)
2020

2121
setup(
22-
name='testapp_python3_googlendk',
22+
name='python3_googlendk',
2323
version='1.1',
2424
description='p4a setup.py test',
2525
author='Alexander Taylor',

testapps/setup_testapp_python3_matplotlib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
print('packages are', packages)
2020

2121
setup(
22-
name='testapp_matplotlib',
22+
name='matplotlib_testapp',
2323
version='0.1',
2424
description='p4a setup.py test',
2525
author='Alexander Taylor',

0 commit comments

Comments
 (0)