Skip to content

Commit b3bafeb

Browse files
committed
Merge branch 'master' of github.com:kivy/python-for-android
2 parents 63a8722 + 32a19db commit b3bafeb

File tree

3 files changed

+105
-1
lines changed

3 files changed

+105
-1
lines changed

distribute.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ function push_arm() {
135135
#export OFLAG="-Os"
136136
#export OFLAG="-O2"
137137

138-
export CFLAGS="-mandroid $OFLAG -fomit-frame-pointer --sysroot $NDKPLATFORM"
138+
export CFLAGS="-DANDROID -mandroid $OFLAG -fomit-frame-pointer --sysroot $NDKPLATFORM"
139139
if [ "X$ARCH" == "Xarmeabi-v7a" ]; then
140140
CFLAGS+=" -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb"
141141
fi

recipes/numpy/patches/fix-numpy.patch

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

recipes/numpy/recipe.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
3+
VERSION_numpy=1.7.1
4+
URL_numpy=http://pypi.python.org/packages/source/n/numpy/numpy-$VERSION_numpy.tar.gz
5+
DEPS_numpy=(python)
6+
MD5_numpy=0ab72b3b83528a7ae79c6df9042d61c6
7+
BUILD_numpy=$BUILD_PATH/numpy/$(get_directory $URL_numpy)
8+
RECIPE_numpy=$RECIPES_PATH/numpy
9+
10+
function prebuild_numpy() {
11+
cd $BUILD_numpy
12+
13+
if [ -f .patched ]; then
14+
return
15+
fi
16+
17+
try patch -p1 < $RECIPE_numpy/patches/fix-numpy.patch
18+
touch .patched
19+
}
20+
21+
function build_numpy() {
22+
23+
if [ -d "$BUILD_PATH/python-install/lib/python2.7/site-packages/numpy" ]; then
24+
return
25+
fi
26+
27+
cd $BUILD_numpy
28+
29+
push_arm
30+
31+
try $BUILD_PATH/python-install/bin/python.host setup.py build_ext -v
32+
try find build/lib.* -name "*.o" -exec $STRIP {} \;
33+
try $BUILD_PATH/python-install/bin/python.host setup.py install -O2
34+
35+
pop_arm
36+
}
37+
38+
function postbuild_numpy() {
39+
true
40+
}

0 commit comments

Comments
 (0)