Skip to content

Commit

Permalink
Merge d63adf2 into e6a6271
Browse files Browse the repository at this point in the history
  • Loading branch information
inclement committed Jun 29, 2019
2 parents e6a6271 + d63adf2 commit f660966
Show file tree
Hide file tree
Showing 12 changed files with 111 additions and 94 deletions.
2 changes: 2 additions & 0 deletions ci/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class TargetPython(Enum):
'websocket-client',
'zeroconf',
'zope',
'matplotlib', # https://github.com/kivy/python-for-android/issues/1900
])
BROKEN_RECIPES_PYTHON3 = set([
'brokenrecipe',
Expand All @@ -77,6 +78,7 @@ class TargetPython(Enum):
# mpmath package with a version >= 0.19 required
'sympy',
'vlc',
'matplotlib', # https://github.com/kivy/python-for-android/issues/1900
])

BROKEN_RECIPES = {
Expand Down
18 changes: 9 additions & 9 deletions pythonforandroid/recipes/matplotlib/mpl_android_fixes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@ index fc82d5d..2067db0 100644
+++ b/setupext.py
@@ -1004,10 +1004,10 @@ class Numpy(SetupPackage):
ext.define_macros.append(('__STDC_FORMAT_MACROS', 1))

def get_setup_requires(self):
- return ['numpy>=1.10.0']
+ return ['numpy==1.15.1'] # to match p4a's target version
+ return ['numpy==1.16.4'] # to match p4a's target version

def get_install_requires(self):
- return ['numpy>=1.10.0']
+ return ['numpy==1.15.1'] # to match p4a's target version
+ return ['numpy==1.16.4'] # to match p4a's target version


class LibAgg(SetupPackage):
@@ -1443,9 +1443,10 @@ class BackendAgg(OptionalBackendPackage):

class BackendTkAgg(OptionalBackendPackage):
name = "tkagg"
- force = True
+ force = False

def check(self):
+ raise CheckFailed("Disabled by patching during Android build") # tk doesn't work on Android but causes build problems
return "installing; run-time loading from Python Tcl / Tk"

def get_extension(self):
16 changes: 10 additions & 6 deletions pythonforandroid/recipes/numpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,21 @@

class NumpyRecipe(CompiledComponentsPythonRecipe):

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

patches = [
join('patches', 'fix-numpy.patch'),
join('patches', 'prevent_libs_check.patch'),
join('patches', 'add_libm_explicitly_to_build.patch'),
join('patches', 'do_not_use_system_libs.patch'),
join('patches', 'remove_unittest_call.patch'),
join('patches', 'ar.patch'),
join('patches', 'lib.patch'),
join('patches', 'python-fixes.patch')
]
join('patches', 'fix_setup_dependencies.patch'),
join('patches', 'fix_environment_detection.patch'),
]

call_hostpython_via_targetpython = False

def build_compiled_components(self, arch):
self.setup_extra_args = ['-j', str(cpu_count())]
Expand Down Expand Up @@ -52,6 +55,7 @@ def get_recipe_env(self, arch):
env['CC'] += flags
if flags not in env['LD']:
env['LD'] += flags + ' -shared'

return env


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/numpy/fft/setup.py b/numpy/fft/setup.py
index cd99a82d7..e614ecd07 100644
index cd99a82..cd7c1ef 100644
--- a/numpy/fft/setup.py
+++ b/numpy/fft/setup.py
@@ -9,7 +9,8 @@ def configuration(parent_package='',top_path=None):
Expand All @@ -8,12 +8,12 @@ index cd99a82d7..e614ecd07 100644
config.add_extension('fftpack_lite',
- sources=['fftpack_litemodule.c', 'fftpack.c']
+ sources=['fftpack_litemodule.c', 'fftpack.c'],
+ libraries=['m']
+ libraries=['m'],
)

return config
diff --git a/numpy/linalg/setup.py b/numpy/linalg/setup.py
index 66c07c9e1..d34bd930a 100644
index 66c07c9..d34bd93 100644
--- a/numpy/linalg/setup.py
+++ b/numpy/linalg/setup.py
@@ -43,6 +43,7 @@ def configuration(parent_package='', top_path=None):
Expand All @@ -34,10 +34,10 @@ index 66c07c9e1..d34bd930a 100644
return config

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

Expand Down
25 changes: 11 additions & 14 deletions pythonforandroid/recipes/numpy/patches/ar.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/numpy/core/code_generators/generate_umath.py b/numpy/core/code_generators/generate_umath.py
index 632bcb4..c1e0dd5 100644
index 0fac9b0..94be92a 100644
--- a/numpy/core/code_generators/generate_umath.py
+++ b/numpy/core/code_generators/generate_umath.py
@@ -970,6 +970,7 @@ def make_arrays(funcdict):
@@ -982,6 +982,7 @@ def make_arrays(funcdict):
funclist.append('%s_%s' % (tname, name))
if t.simd is not None:
for vt in t.simd:
Expand All @@ -11,30 +11,27 @@ index 632bcb4..c1e0dd5 100644
#ifdef HAVE_ATTRIBUTE_TARGET_{ISA}
if (npy_cpu_supports("{isa}")) {{
diff --git a/numpy/distutils/ccompiler.py b/numpy/distutils/ccompiler.py
index b03fb96..f9e6cd0 100644
index 14451fa..dfd65da 100644
--- a/numpy/distutils/ccompiler.py
+++ b/numpy/distutils/ccompiler.py
@@ -275,6 +275,7 @@ def CCompiler_compile(self, sources, output_dir=None, macros=None,
@@ -295,6 +295,7 @@ def CCompiler_compile(self, sources, output_dir=None, macros=None,
self._setup_compile(output_dir, macros, include_dirs, sources,
depends, extra_postargs)
cc_args = self._get_cc_args(pp_opts, debug, extra_preargs)
+ cc_args += os.environ['CFLAGS'].split()
display = "compile options: '%s'" % (' '.join(cc_args))
if extra_postargs:
display += "\nextra options: '%s'" % (' '.join(extra_postargs))
@@ -795,4 +796,3 @@ for _cc in ['msvc9', 'msvc', '_msvc', 'bcpp', 'cygwinc', 'emxc', 'unixc']:
_m = sys.modules.get('distutils.' + _cc + 'compiler')
if _m is not None:
setattr(_m, 'gen_lib_options', gen_lib_options)
-
diff --git a/numpy/distutils/unixccompiler.py b/numpy/distutils/unixccompiler.py
index 11b2cce..f6dde79 100644
index 11b2cce..c3e9f10 100644
--- a/numpy/distutils/unixccompiler.py
+++ b/numpy/distutils/unixccompiler.py
@@ -54,6 +54,7 @@ def UnixCCompiler__compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts
deps = []

try:
+ self.linker_so = [os.environ['LD']+" "+os.environ['LDFLAGS']]
self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + deps +
extra_postargs, display = display)
except DistutilsExecError:
@@ -111,6 +112,7 @@ def UnixCCompiler_create_static_lib(self, objects, output_libname,
@@ -111,6 +111,7 @@ def UnixCCompiler_create_static_lib(self, objects, output_libname,
while tmp_objects:
objects = tmp_objects[:50]
tmp_objects = tmp_objects[50:]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py
index bea120cf9..a448a83fc 100644
index 806f4f7..0d51cfa 100644
--- a/numpy/distutils/system_info.py
+++ b/numpy/distutils/system_info.py
@@ -719,6 +719,7 @@ class system_info(object):
@@ -734,6 +734,7 @@ class system_info(object):
return self.get_paths(self.section, key)

def get_libs(self, key, default):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
commit 9a09edac303c534a38c5d829d8537176f8a8dfb9
Author: Alexander Taylor <alexanderjohntaylor@gmail.com>
Date: Fri Jun 28 22:50:45 2019 +0100

fix_environment_detection.patch

diff --git a/numpy/core/include/numpy/npy_common.h b/numpy/core/include/numpy/npy_common.h
index 64aaaac..e6293f9 100644
--- a/numpy/core/include/numpy/npy_common.h
+++ b/numpy/core/include/numpy/npy_common.h
@@ -164,12 +164,12 @@ extern long long __cdecl _ftelli64(FILE *);
#endif
#else
#ifdef HAVE_FSEEKO
- #define npy_fseek fseeko
+ #define npy_fseek fseek
#else
#define npy_fseek fseek
#endif
#ifdef HAVE_FTELLO
- #define npy_ftell ftello
+ #define npy_ftell ftell
#else
#define npy_ftell ftell
#endif
@@ -321,13 +321,15 @@ typedef unsigned char npy_bool;
#define NPY_TRUE 1


-#if NPY_SIZEOF_LONGDOUBLE == NPY_SIZEOF_DOUBLE
- typedef double npy_longdouble;
- #define NPY_LONGDOUBLE_FMT "g"
-#else
- typedef long double npy_longdouble;
- #define NPY_LONGDOUBLE_FMT "Lg"
-#endif
+/* #if NPY_SIZEOF_LONGDOUBLE == NPY_SIZEOF_DOUBLE */
+/* typedef double npy_longdouble; */
+/* #define NPY_LONGDOUBLE_FMT "g" */
+/* #else */
+/* typedef long double npy_longdouble; */
+/* #define NPY_LONGDOUBLE_FMT "Lg" */
+/* #endif */
+typedef long double npy_longdouble;
+#define NPY_LONGDOUBLE_FMT "Lg"

#ifndef Py_USING_UNICODE
#error Must use Python with unicode enabled.
Original file line number Diff line number Diff line change
@@ -1,35 +1,5 @@
diff --git a/numpy/core/src/multiarray/common.c b/numpy/core/src/multiarray/common.c
index c70f852..695efd5 100644
--- a/numpy/core/src/multiarray/common.c
+++ b/numpy/core/src/multiarray/common.c
@@ -852,3 +852,12 @@ _may_have_objects(PyArray_Descr *dtype)
return (PyDataType_HASFIELDS(base) ||
PyDataType_FLAGCHK(base, NPY_ITEM_HASOBJECT) );
}
+
+/*
+ * Dummy to fix android NDK problem with missing reference.
+ */
+void *
+__emutls_get_address(struct __emutls_object *obj)
+{
+ return NULL;
+}
diff --git a/numpy/distutils/exec_command.py b/numpy/distutils/exec_command.py
index 8118e2f..b586442 100644
--- a/numpy/distutils/exec_command.py
+++ b/numpy/distutils/exec_command.py
@@ -260,7 +260,7 @@ def _exec_command(command, use_shell=None, use_tee = None, **env):
return 127, ''

text, err = proc.communicate()
- text = text.decode(locale.getpreferredencoding(False),
+ text = text.decode('UTF-8',
errors='replace')

text = text.replace('\r\n', '\n')
diff --git a/numpy/distutils/misc_util.py b/numpy/distutils/misc_util.py
index f2d677a..758b1ed 100644
index 42374ac..67fcd98 100644
--- a/numpy/distutils/misc_util.py
+++ b/numpy/distutils/misc_util.py
@@ -9,7 +9,6 @@ import atexit
Expand All @@ -40,23 +10,24 @@ index f2d677a..758b1ed 100644

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

"""
from numpy.distutils.core import get_distribution
- try:
- cpu_count = len(os.sched_getaffinity(0))
- except AttributeError:
- cpu_count = multiprocessing.cpu_count()
- cpu_count = min(cpu_count, 8)
+ cpu_count = 1
envjobs = int(os.environ.get("NPY_NUM_BUILD_JOBS", cpu_count))
dist = get_distribution()
# may be None during configuration
diff --git a/setup.py b/setup.py
index fed178e..b0266eb 100755
index 8b2ded1..431c1b8 100755
--- a/setup.py
+++ b/setup.py
@@ -377,9 +377,8 @@ def setup_package():
@@ -389,9 +389,8 @@ def setup_package():
# Raise errors for unsupported commands, improve help output, etc.
run_build = parse_setuppy_commands()

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

-This single module should provide all the common functionality for numpy tests
-in a single location, so that test scripts can just import it and work right
-away.
-
-"""
"""
-from __future__ import division, absolute_import, print_function
-
-from unittest import TestCase
-
-from ._private.utils import *
Expand All @@ -29,6 +18,13 @@ index a7c8593..007ce26 100644
-
-__all__ = _private.utils.__all__ + ['TestCase', 'run_module_suite']
-
-from ._private.pytesttester import PytestTester
-from numpy._pytesttester import PytestTester
-test = PytestTester(__name__)
-del PytestTester
+# fake tester, android don't have unittest
+class Tester(object):
+ def test(self, *args, **kwargs):
+ pass
+ def bench(self, *args, **kwargs):
+ pass
+test = Tester().test
2 changes: 1 addition & 1 deletion testapps/setup_testapp_python3.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
print('packages are', packages)

setup(
name='testapp_python3_googlendk',
name='python3_googlendk',
version='1.1',
description='p4a setup.py test',
author='Alexander Taylor',
Expand Down
2 changes: 1 addition & 1 deletion testapps/setup_testapp_python3_matplotlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
print('packages are', packages)

setup(
name='testapp_matplotlib',
name='matplotlib_testapp',
version='0.1',
description='p4a setup.py test',
author='Alexander Taylor',
Expand Down
Loading

0 comments on commit f660966

Please sign in to comment.