Skip to content

Commit deff5d6

Browse files
committed
Added (untested) numpy and vispy recipes
1 parent ef25bb7 commit deff5d6

File tree

3 files changed

+106
-0
lines changed

3 files changed

+106
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
from pythonforandroid.toolchain import CompiledComponentsPythonRecipe, shprint, current_directory
3+
from os.path import exists, join
4+
import sh
5+
import glob
6+
7+
8+
class NumpyRecipe(CompiledComponentsPythonRecipe):
9+
10+
version = '1.7.1'
11+
url = 'http://pypi.python.org/packages/source/n/numpy/numpy-{version}.tar.gz'
12+
site_packages_name= 'numpy'
13+
14+
depends = ['python2']
15+
16+
def prebuild_arch(self, arch):
17+
super(NumpyRecipe, self).prebuild_arch(arch)
18+
build_dir = self.get_build_dir(arch.arch)
19+
if exists(join(build_dir, '.patched')):
20+
print('numpy already patched, skipping')
21+
return
22+
23+
self.apply_patch('patches/fix-numpy.patch')
24+
25+
shprint(sh.touch, join(build_dir, '.patched'))
26+
27+
28+
recipe = NumpyRecipe()
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
diff -x build -x '*.pyc' -x '*.swp' -Naur numpy-1.7.1.orig/numpy/core/src/multiarray/numpyos.c numpy-1.7.1/numpy/core/src/multiarray/numpyos.c
2+
--- numpy-1.7.1.orig/numpy/core/src/multiarray/numpyos.c 2013-04-07 07:04:05.000000000 +0200
3+
+++ numpy-1.7.1/numpy/core/src/multiarray/numpyos.c 2013-05-03 10:57:35.812501674 +0200
4+
@@ -170,8 +170,7 @@
5+
static void
6+
_change_decimal_from_locale_to_dot(char* buffer)
7+
{
8+
- struct lconv *locale_data = localeconv();
9+
- const char *decimal_point = locale_data->decimal_point;
10+
+ const char *decimal_point = ".";
11+
12+
if (decimal_point[0] != '.' || decimal_point[1] != 0) {
13+
size_t decimal_point_len = strlen(decimal_point);
14+
@@ -455,8 +454,7 @@
15+
NPY_NO_EXPORT double
16+
NumPyOS_ascii_strtod(const char *s, char** endptr)
17+
{
18+
- struct lconv *locale_data = localeconv();
19+
- const char *decimal_point = locale_data->decimal_point;
20+
+ const char *decimal_point = ".";
21+
size_t decimal_point_len = strlen(decimal_point);
22+
23+
char buffer[FLOAT_FORMATBUFLEN+1];
24+
diff -x build -x '*.pyc' -x '*.swp' -Naur numpy-1.7.1.orig/numpy/core/src/private/npy_config.h numpy-1.7.1/numpy/core/src/private/npy_config.h
25+
--- numpy-1.7.1.orig/numpy/core/src/private/npy_config.h 2013-04-07 07:04:05.000000000 +0200
26+
+++ numpy-1.7.1/numpy/core/src/private/npy_config.h 2013-05-03 10:57:35.812501674 +0200
27+
@@ -41,4 +41,12 @@
28+
#define SIZEOF_PY_INTPTR_T 4
29+
#endif
30+
#endif
31+
+
32+
+/* Android only
33+
+ */
34+
+#ifdef ANDROID
35+
+#undef HAVE_LDEXPL
36+
+#undef HAVE_FREXPL
37+
+#endif
38+
+
39+
#endif
40+
diff -x build -x '*.pyc' -x '*.swp' -Naur numpy-1.7.1.orig/numpy/testing/__init__.py numpy-1.7.1/numpy/testing/__init__.py
41+
--- numpy-1.7.1.orig/numpy/testing/__init__.py 2013-04-07 07:04:05.000000000 +0200
42+
+++ numpy-1.7.1/numpy/testing/__init__.py 2013-05-03 11:09:29.316488099 +0200
43+
@@ -1,15 +1,7 @@
44+
-"""Common test support for all numpy test scripts.
45+
-
46+
-This single module should provide all the common functionality for numpy tests
47+
-in a single location, so that test scripts can just import it and work right
48+
-away.
49+
-"""
50+
-
51+
-from unittest import TestCase
52+
-
53+
-import decorators as dec
54+
-from utils import *
55+
-from numpytest import *
56+
-from nosetester import NoseTester as Tester
57+
-from nosetester import run_module_suite
58+
+# fake tester, android don't have unittest
59+
+class Tester(object):
60+
+ def test(self, *args, **kwargs):
61+
+ pass
62+
+ def bench(self, *args, **kwargs):
63+
+ pass
64+
test = Tester().test
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
from pythonforandroid.toolchain import PythonRecipe, shprint, current_directory
3+
from os.path import exists, join
4+
import sh
5+
import glob
6+
7+
8+
class VispyRecipe(PythonRecipe):
9+
version = 'master'
10+
url = 'https://github.com/vispy/vispy/archive/{version}.zip'
11+
12+
depends = ['python2', 'numpy']
13+
14+
recipe = VispyRecipe()

0 commit comments

Comments
 (0)