Skip to content

Commit a67526d

Browse files
committed
Fix numpy's recipe and adds python3's compatibility.
Also: - add numpy to CI tests for python3: this module is some kind of special and probably a dependency for a lot of python packages so better make sure that we not break anything...as we already do with python2 - Add numpy to python2 and python3 test apps, cause already have some buttons that allows to test it from the running app.
1 parent 1796c51 commit a67526d

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ env:
1818
- ANDROID_SDK_HOME=/opt/android/android-sdk
1919
- ANDROID_NDK_HOME=/opt/android/android-ndk
2020
matrix:
21-
- COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python3.py apk --sdk-dir $ANDROID_SDK_HOME --ndk-dir $ANDROID_NDK_HOME --requirements sdl2,pyjnius,kivy,python3'
21+
- COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python3.py apk --sdk-dir $ANDROID_SDK_HOME --ndk-dir $ANDROID_NDK_HOME --requirements sdl2,pyjnius,kivy,python3,numpy'
2222
# overrides requirements to skip `peewee` pure python module, see:
2323
# https://github.com/kivy/python-for-android/issues/1263#issuecomment-390421054
2424
- COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python2_sqlite_openssl.py apk --sdk-dir $ANDROID_SDK_HOME --ndk-dir $ANDROID_NDK_HOME --requirements sdl2,pyjnius,kivy,python2,openssl,requests,sqlite3,setuptools'

pythonforandroid/recipes/numpy/__init__.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ class NumpyRecipe(CompiledComponentsPythonRecipe):
99
url = 'https://pypi.python.org/packages/source/n/numpy/numpy-{version}.zip'
1010
site_packages_name = 'numpy'
1111

12-
depends = [('python2', 'python3crystax')]
12+
depends = [('python2', 'python3', 'python3crystax')]
1313

1414
patches = [
1515
join('patches', 'fix-numpy.patch'),
1616
join('patches', 'prevent_libs_check.patch'),
1717
join('patches', 'ar.patch'),
1818
join('patches', 'lib.patch'),
19-
join('patches', 'python2-fixes.patch')
19+
join('patches', 'python-fixes.patch')
2020
]
2121

2222
def get_recipe_env(self, arch):
@@ -27,17 +27,17 @@ def get_recipe_env(self, arch):
2727
self.ctx.ndk_platform
2828
)
2929

30+
py_ver = self.ctx.python_recipe.major_minor_version_string
31+
py_inc_dir = self.ctx.python_recipe.include_root(arch.arch)
32+
py_lib_dir = self.ctx.python_recipe.link_root(arch.arch)
3033
if self.ctx.ndk == 'crystax':
31-
py_ver = self.ctx.python_recipe.version[0:3]
3234
src_dir = join(self.ctx.ndk_dir, 'sources')
33-
py_inc_dir = join(src_dir, 'python', py_ver, 'include', 'python')
34-
py_lib_dir = join(src_dir, 'python', py_ver, 'libs', arch.arch)
35-
cry_inc_dir = join(src_dir, 'crystax', 'include')
36-
cry_lib_dir = join(src_dir, 'crystax', 'libs', arch.arch)
37-
flags += ' -I{}'.format(py_inc_dir)
38-
flags += ' -L{} -lpython{}m'.format(py_lib_dir, py_ver)
39-
flags += " -I{}".format(cry_inc_dir)
40-
flags += " -L{}".format(cry_lib_dir)
35+
flags += " -I{}".format(join(src_dir, 'crystax', 'include'))
36+
flags += " -L{}".format(join(src_dir, 'crystax', 'libs', arch.arch))
37+
flags += ' -I{}'.format(py_inc_dir)
38+
flags += ' -L{} -lpython{}'.format(py_lib_dir, py_ver)
39+
if 'python3' in self.ctx.python_recipe.name:
40+
flags += 'm'
4141

4242
if flags not in env['CC']:
4343
env['CC'] += flags

testapps/setup_testapp_python2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from distutils.core import setup
33
from setuptools import find_packages
44

5-
options = {'apk': {'requirements': 'sdl2,pyjnius,kivy,python2',
5+
options = {'apk': {'requirements': 'numpy,sdl2,pyjnius,kivy,python2',
66
'android-api': 27,
77
'ndk-api': 21,
88
'ndk-dir': '/home/asandy/android/crystax-ndk-10.3.2',

testapps/setup_testapp_python3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from distutils.core import setup
33
from setuptools import find_packages
44

5-
options = {'apk': {'requirements': 'sdl2,pyjnius,kivy,python3',
5+
options = {'apk': {'requirements': 'numpy,sdl2,pyjnius,kivy,python3',
66
'android-api': 27,
77
'ndk-api': 21,
88
'dist-name': 'bdisttest_python3_googlendk',

0 commit comments

Comments
 (0)