Added Python3. (Still testing integration)
This commit is contained in:
30
project/jni/python3/mk/python/3.4.3/build.sh
Normal file
30
project/jni/python3/mk/python/3.4.3/build.sh
Normal file
@@ -0,0 +1,30 @@
|
||||
pushd src >/dev/null
|
||||
|
||||
rm -rf "Python-${VERSION}"
|
||||
tar -xf "Python-${VERSION}.tar.xz" || exit 1
|
||||
pushd "Python-${VERSION}" >/dev/null
|
||||
|
||||
# Build host components.
|
||||
AR=ar AS=as CC=gcc CFLAGS= CPP=cpp CPPFLAGS= CXX=g++ CXXFLAGS= LD=ld LDFLAGS= RANLIB=ranlib ./configure || exit 1
|
||||
AR=ar AS=as CC=gcc CFLAGS= CPP=cpp CPPFLAGS= CXX=g++ CXXFLAGS= LD=ld LDFLAGS= RANLIB=ranlib make BUILDPYTHON=hostpython hostpython PGEN=Parser/hostpgen Parser/hostpgen || exit 1
|
||||
make distclean || exit 1
|
||||
|
||||
# Apply patches and build target Python.
|
||||
cat > config.site <<-SITE
|
||||
ac_cv_file__dev_ptmx=no
|
||||
ac_cv_file__dev_ptc=no
|
||||
SITE
|
||||
ln -sf "${TOOL_PREFIX}/sysroot/usr/include/"{linux,sys}"/soundcard.h"
|
||||
patch -p1 < "${FILESDIR}/${PACKAGE}-cross-compile.patch" || exit 1
|
||||
patch -p1 < "${FILESDIR}/${PACKAGE}-python-misc.patch" || exit 1
|
||||
patch -p1 < "${FILESDIR}/${PACKAGE}-android-locale.patch" || exit 1
|
||||
patch -Ep1 < "${FILESDIR}/${PACKAGE}-android-libmpdec.patch" || exit 1
|
||||
[[ "${NDK_REV}" != 10* ]] && (patch -p1 < "${FILESDIR}/${PACKAGE}-android-missing-getdents64-definition.patch" || exit 1)
|
||||
patch -p1 < "${FILESDIR}/${PACKAGE}-android-misc.patch" || exit 1
|
||||
|
||||
./configure CROSS_COMPILE_TARGET=yes HOSTPYTHON="$(pwd)/hostpython" CONFIG_SITE=config.site --prefix="${PREFIX}" --host="${TARGET}" --build="${HOST}" --disable-ipv6 --enable-shared --without-ensurepip || exit 1
|
||||
make CROSS_COMPILE_TARGET=yes HOSTPYTHON="$(pwd)/hostpython" HOSTPGEN="$(pwd)/Parser/hostpgen" || exit 1
|
||||
make CROSS_COMPILE_TARGET=yes HOSTPYTHON="$(pwd)/hostpython" HOSTPGEN="$(pwd)/Parser/hostpgen" install || exit 1
|
||||
|
||||
popd >/dev/null
|
||||
popd >/dev/null
|
||||
@@ -0,0 +1,158 @@
|
||||
diff -Nru Python-3.3.5/Modules/_decimal/libmpdec/basearith.c Python-3.3.5-android/Modules/_decimal/libmpdec/basearith.c
|
||||
--- Python-3.3.5/Modules/_decimal/libmpdec/basearith.c 2014-03-09 09:40:25.000000000 +0100
|
||||
+++ Python-3.3.5-android/Modules/_decimal/libmpdec/basearith.c 2014-08-05 16:11:29.000000000 +0200
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include "constants.h"
|
||||
-#include "memory.h"
|
||||
+#include "mpmemory.h"
|
||||
#include "typearith.h"
|
||||
#include "basearith.h"
|
||||
|
||||
diff -Nru Python-3.3.5/Modules/_decimal/libmpdec/io.c Python-3.3.5-android/Modules/_decimal/libmpdec/io.c
|
||||
--- Python-3.3.5/Modules/_decimal/libmpdec/io.c 2014-08-05 16:05:22.000000000 +0200
|
||||
+++ Python-3.3.5-android/Modules/_decimal/libmpdec/io.c 2014-08-05 16:11:42.000000000 +0200
|
||||
@@ -37,7 +37,7 @@
|
||||
#include <locale.h>
|
||||
#include "bits.h"
|
||||
#include "constants.h"
|
||||
-#include "memory.h"
|
||||
+#include "mpmemory.h"
|
||||
#include "typearith.h"
|
||||
#include "io.h"
|
||||
|
||||
diff -Nru Python-3.3.5/Modules/_decimal/libmpdec/memory.c Python-3.3.5-android/Modules/_decimal/libmpdec/memory.c
|
||||
--- Python-3.3.5/Modules/_decimal/libmpdec/memory.c 2014-03-09 09:40:25.000000000 +0100
|
||||
+++ Python-3.3.5-android/Modules/_decimal/libmpdec/memory.c 2014-08-05 16:11:52.000000000 +0200
|
||||
@@ -30,7 +30,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "typearith.h"
|
||||
-#include "memory.h"
|
||||
+#include "mpmemory.h"
|
||||
|
||||
|
||||
/* Guaranteed minimum allocation for a coefficient. May be changed once
|
||||
diff -Nru Python-3.3.5/Modules/_decimal/libmpdec/memory.h Python-3.3.5-android/Modules/_decimal/libmpdec/memory.h
|
||||
--- Python-3.3.5/Modules/_decimal/libmpdec/memory.h 2014-03-09 09:40:25.000000000 +0100
|
||||
+++ Python-3.3.5-android/Modules/_decimal/libmpdec/memory.h 1970-01-01 01:00:00.000000000 +0100
|
||||
@@ -1,51 +0,0 @@
|
||||
-/*
|
||||
- * Copyright (c) 2008-2016 Stefan Krah. All rights reserved.
|
||||
- *
|
||||
- * Redistribution and use in source and binary forms, with or without
|
||||
- * modification, are permitted provided that the following conditions
|
||||
- * are met:
|
||||
- *
|
||||
- * 1. Redistributions of source code must retain the above copyright
|
||||
- * notice, this list of conditions and the following disclaimer.
|
||||
- *
|
||||
- * 2. Redistributions in binary form must reproduce the above copyright
|
||||
- * notice, this list of conditions and the following disclaimer in the
|
||||
- * documentation and/or other materials provided with the distribution.
|
||||
- *
|
||||
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
|
||||
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
- * SUCH DAMAGE.
|
||||
- */
|
||||
-
|
||||
-
|
||||
-#ifndef MEMORY_H
|
||||
-#define MEMORY_H
|
||||
-
|
||||
-
|
||||
-#include "mpdecimal.h"
|
||||
-
|
||||
-
|
||||
-/* Internal header file: all symbols have local scope in the DSO */
|
||||
-MPD_PRAGMA(MPD_HIDE_SYMBOLS_START)
|
||||
-
|
||||
-
|
||||
-int mpd_switch_to_dyn(mpd_t *result, mpd_ssize_t size, uint32_t *status);
|
||||
-int mpd_switch_to_dyn_zero(mpd_t *result, mpd_ssize_t size, uint32_t *status);
|
||||
-int mpd_realloc_dyn(mpd_t *result, mpd_ssize_t size, uint32_t *status);
|
||||
-
|
||||
-
|
||||
-MPD_PRAGMA(MPD_HIDE_SYMBOLS_END) /* restore previous scope rules */
|
||||
-
|
||||
-
|
||||
-#endif
|
||||
-
|
||||
-
|
||||
-
|
||||
diff -Nru Python-3.3.5/Modules/_decimal/libmpdec/mpdecimal.c Python-3.3.5-android/Modules/_decimal/libmpdec/mpdecimal.c
|
||||
--- Python-3.3.5/Modules/_decimal/libmpdec/mpdecimal.c 2014-03-09 09:40:25.000000000 +0100
|
||||
+++ Python-3.3.5-android/Modules/_decimal/libmpdec/mpdecimal.c 2014-08-05 16:12:06.000000000 +0200
|
||||
@@ -36,7 +36,7 @@
|
||||
#include "bits.h"
|
||||
#include "convolute.h"
|
||||
#include "crt.h"
|
||||
-#include "memory.h"
|
||||
+#include "mpmemory.h"
|
||||
#include "typearith.h"
|
||||
#include "umodarith.h"
|
||||
|
||||
diff -Nru Python-3.3.5/Modules/_decimal/libmpdec/mpmemory.h Python-3.3.5-android/Modules/_decimal/libmpdec/mpmemory.h
|
||||
--- Python-3.3.5/Modules/_decimal/libmpdec/mpmemory.h 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ Python-3.3.5-android/Modules/_decimal/libmpdec/mpmemory.h 2014-08-05 16:10:00.000000000 +0200
|
||||
@@ -0,0 +1,51 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2008-2016 Stefan Krah. All rights reserved.
|
||||
+ *
|
||||
+ * Redistribution and use in source and binary forms, with or without
|
||||
+ * modification, are permitted provided that the following conditions
|
||||
+ * are met:
|
||||
+ *
|
||||
+ * 1. Redistributions of source code must retain the above copyright
|
||||
+ * notice, this list of conditions and the following disclaimer.
|
||||
+ *
|
||||
+ * 2. Redistributions in binary form must reproduce the above copyright
|
||||
+ * notice, this list of conditions and the following disclaimer in the
|
||||
+ * documentation and/or other materials provided with the distribution.
|
||||
+ *
|
||||
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
|
||||
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
+ * SUCH DAMAGE.
|
||||
+ */
|
||||
+
|
||||
+
|
||||
+#ifndef MEMORY_H
|
||||
+#define MEMORY_H
|
||||
+
|
||||
+
|
||||
+#include "mpdecimal.h"
|
||||
+
|
||||
+
|
||||
+/* Internal header file: all symbols have local scope in the DSO */
|
||||
+MPD_PRAGMA(MPD_HIDE_SYMBOLS_START)
|
||||
+
|
||||
+
|
||||
+int mpd_switch_to_dyn(mpd_t *result, mpd_ssize_t size, uint32_t *status);
|
||||
+int mpd_switch_to_dyn_zero(mpd_t *result, mpd_ssize_t size, uint32_t *status);
|
||||
+int mpd_realloc_dyn(mpd_t *result, mpd_ssize_t size, uint32_t *status);
|
||||
+
|
||||
+
|
||||
+MPD_PRAGMA(MPD_HIDE_SYMBOLS_END) /* restore previous scope rules */
|
||||
+
|
||||
+
|
||||
+#endif
|
||||
+
|
||||
+
|
||||
+
|
||||
@@ -0,0 +1,255 @@
|
||||
diff -ru Python-3.3.5/Modules/Setup.dist Python-3.3.5-android/Modules/Setup.dist
|
||||
--- Python-3.3.5/Modules/Setup.dist 2014-03-09 09:40:23.000000000 +0100
|
||||
+++ Python-3.3.5-android/Modules/Setup.dist 2014-08-04 22:16:29.000000000 +0200
|
||||
@@ -118,7 +118,7 @@
|
||||
itertools itertoolsmodule.c # Functions creating iterators for efficient looping
|
||||
|
||||
# access to ISO C locale support
|
||||
-_locale _localemodule.c # -lintl
|
||||
+#_locale _localemodule.c # -lintl
|
||||
|
||||
# Standard I/O baseline
|
||||
_io -I$(srcdir)/Modules/_io _io/_iomodule.c _io/iobase.c _io/fileio.c _io/bytesio.c _io/bufferedio.c _io/textio.c _io/stringio.c
|
||||
diff -ru Python-3.3.5/Modules/_decimal/libmpdec/io.c Python-3.3.5-android/Modules/_decimal/libmpdec/io.c
|
||||
--- Python-3.3.5/Modules/_decimal/libmpdec/io.c 2014-03-09 09:40:25.000000000 +0100
|
||||
+++ Python-3.3.5-android/Modules/_decimal/libmpdec/io.c 2014-08-04 22:16:29.000000000 +0200
|
||||
@@ -868,10 +868,17 @@
|
||||
}
|
||||
spec->type = *cp++;
|
||||
spec->type = (spec->type == 'N') ? 'G' : 'g';
|
||||
+#ifdef __ANDROID__
|
||||
+ spec->dot = ".";
|
||||
+ spec->sep = ",";
|
||||
+ spec->grouping = "\3";
|
||||
+#else
|
||||
lc = localeconv();
|
||||
spec->dot = lc->decimal_point;
|
||||
spec->sep = lc->thousands_sep;
|
||||
spec->grouping = lc->grouping;
|
||||
+#endif
|
||||
+
|
||||
if (mpd_validate_lconv(spec) < 0) {
|
||||
return 0; /* GCOV_NOT_REACHED */
|
||||
}
|
||||
diff -ru Python-3.3.5/Modules/_localemodule.c Python-3.3.5-android/Modules/_localemodule.c
|
||||
--- Python-3.3.5/Modules/_localemodule.c 2014-03-09 09:40:26.000000000 +0100
|
||||
+++ Python-3.3.5-android/Modules/_localemodule.c 2014-08-04 22:16:29.000000000 +0200
|
||||
@@ -38,6 +38,13 @@
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
+#if __ANDROID__
|
||||
+/* Android's locale support is pretty much unusable, it's better to have the
|
||||
+ higher-level module fall back to C locale emulation. */
|
||||
+#error "Android's locale support is too incomplete to create a usable module."
|
||||
+#endif
|
||||
+
|
||||
+
|
||||
PyDoc_STRVAR(locale__doc__, "Support for POSIX locales.");
|
||||
|
||||
static PyObject *Error;
|
||||
@@ -141,6 +148,11 @@
|
||||
if (!result)
|
||||
return NULL;
|
||||
|
||||
+#ifdef __ANDROID__
|
||||
+ /* Don't even try on Android's broken locale.h. */
|
||||
+ goto failed;
|
||||
+#else
|
||||
+
|
||||
/* if LC_NUMERIC is different in the C library, use saved value */
|
||||
l = localeconv();
|
||||
|
||||
@@ -189,6 +201,7 @@
|
||||
RESULT_INT(p_sign_posn);
|
||||
RESULT_INT(n_sign_posn);
|
||||
return result;
|
||||
+#endif // __ANDROID__
|
||||
|
||||
failed:
|
||||
Py_XDECREF(result);
|
||||
diff -ru Python-3.3.5/Modules/main.c Python-3.3.5-android/Modules/main.c
|
||||
--- Python-3.3.5/Modules/main.c 2014-03-09 09:40:27.000000000 +0100
|
||||
+++ Python-3.3.5-android/Modules/main.c 2014-08-04 22:16:29.000000000 +0200
|
||||
@@ -522,7 +522,7 @@
|
||||
oldloc = strdup(setlocale(LC_ALL, NULL));
|
||||
setlocale(LC_ALL, "");
|
||||
for (p = strtok(buf, ","); p != NULL; p = strtok(NULL, ",")) {
|
||||
-#ifdef __APPLE__
|
||||
+#if defined(__APPLE__) || defined(__ANDROID__)
|
||||
/* Use utf-8 on Mac OS X */
|
||||
unicode = PyUnicode_FromString(p);
|
||||
#else
|
||||
diff -ru Python-3.3.5/Objects/unicodeobject.c Python-3.3.5-android/Objects/unicodeobject.c
|
||||
--- Python-3.3.5/Objects/unicodeobject.c 2014-03-09 09:40:30.000000000 +0100
|
||||
+++ Python-3.3.5-android/Objects/unicodeobject.c 2014-08-04 22:16:29.000000000 +0200
|
||||
@@ -3295,13 +3295,22 @@
|
||||
static int
|
||||
locale_error_handler(const char *errors, int *surrogateescape)
|
||||
{
|
||||
+
|
||||
if (errors == NULL) {
|
||||
+#ifdef __ANDROID__
|
||||
+ *surrogateescape = 1;
|
||||
+#else
|
||||
*surrogateescape = 0;
|
||||
+#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (strcmp(errors, "strict") == 0) {
|
||||
+#ifdef __ANDROID__
|
||||
+ *surrogateescape = 1;
|
||||
+#else
|
||||
*surrogateescape = 0;
|
||||
+#endif
|
||||
return 0;
|
||||
}
|
||||
if (strcmp(errors, "surrogateescape") == 0) {
|
||||
@@ -3429,7 +3438,7 @@
|
||||
{
|
||||
#ifdef HAVE_MBCS
|
||||
return PyUnicode_EncodeCodePage(CP_ACP, unicode, NULL);
|
||||
-#elif defined(__APPLE__)
|
||||
+#elif defined(__APPLE__) || defined(__ANDROID__)
|
||||
return _PyUnicode_AsUTF8String(unicode, "surrogateescape");
|
||||
#else
|
||||
PyInterpreterState *interp = PyThreadState_GET()->interp;
|
||||
@@ -3709,7 +3718,7 @@
|
||||
{
|
||||
#ifdef HAVE_MBCS
|
||||
return PyUnicode_DecodeMBCS(s, size, NULL);
|
||||
-#elif defined(__APPLE__)
|
||||
+#elif defined(__APPLE__) || defined(__ANDROID__)
|
||||
return PyUnicode_DecodeUTF8Stateful(s, size, "surrogateescape", NULL);
|
||||
#else
|
||||
PyInterpreterState *interp = PyThreadState_GET()->interp;
|
||||
@@ -4835,7 +4844,7 @@
|
||||
return NULL;
|
||||
}
|
||||
|
||||
-#ifdef __APPLE__
|
||||
+#if defined(__APPLE__) || defined(__ANDROID__)
|
||||
|
||||
/* Simplified UTF-8 decoder using surrogateescape error handler,
|
||||
used to decode the command line arguments on Mac OS X.
|
||||
diff -ru Python-3.3.5/Python/bltinmodule.c Python-3.3.5-android/Python/bltinmodule.c
|
||||
--- Python-3.3.5/Python/bltinmodule.c 2014-03-09 09:40:32.000000000 +0100
|
||||
+++ Python-3.3.5-android/Python/bltinmodule.c 2014-08-04 22:16:29.000000000 +0200
|
||||
@@ -24,7 +24,7 @@
|
||||
#ifdef HAVE_MBCS
|
||||
const char *Py_FileSystemDefaultEncoding = "mbcs";
|
||||
int Py_HasFileSystemDefaultEncoding = 1;
|
||||
-#elif defined(__APPLE__)
|
||||
+#elif defined(__APPLE__) || defined(__ANDROID__)
|
||||
const char *Py_FileSystemDefaultEncoding = "utf-8";
|
||||
int Py_HasFileSystemDefaultEncoding = 1;
|
||||
#else
|
||||
diff -ru Python-3.3.5/Python/fileutils.c Python-3.3.5-android/Python/fileutils.c
|
||||
--- Python-3.3.5/Python/fileutils.c 2014-03-09 09:40:32.000000000 +0100
|
||||
+++ Python-3.3.5-android/Python/fileutils.c 2014-08-04 22:16:29.000000000 +0200
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <langinfo.h>
|
||||
#endif
|
||||
|
||||
-#ifdef __APPLE__
|
||||
+#if defined(__APPLE__) || defined(__ANDROID__)
|
||||
extern wchar_t* _Py_DecodeUTF8_surrogateescape(const char *s, Py_ssize_t size);
|
||||
#endif
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
-#if !defined(__APPLE__) && !defined(MS_WINDOWS)
|
||||
+#if !defined(__APPLE__) && !defined(__ANDROID__) && !defined(MS_WINDOWS)
|
||||
extern int _Py_normalize_encoding(const char *, char *, size_t);
|
||||
|
||||
/* Workaround FreeBSD and OpenIndiana locale encoding issue with the C locale.
|
||||
@@ -194,7 +194,7 @@
|
||||
}
|
||||
#endif /* !defined(__APPLE__) && !defined(MS_WINDOWS) */
|
||||
|
||||
-#if !defined(__APPLE__) && (!defined(MS_WINDOWS) || !defined(HAVE_MBRTOWC))
|
||||
+#if !defined(__APPLE__) && !defined(__ANDROID__) && (!defined(MS_WINDOWS) || !defined(HAVE_MBRTOWC))
|
||||
static wchar_t*
|
||||
decode_ascii_surrogateescape(const char *arg, size_t *size)
|
||||
{
|
||||
@@ -241,7 +241,7 @@
|
||||
wchar_t*
|
||||
_Py_char2wchar(const char* arg, size_t *size)
|
||||
{
|
||||
-#ifdef __APPLE__
|
||||
+#if defined(__APPLE__) || defined(__ANDROID__)
|
||||
wchar_t *wstr;
|
||||
wstr = _Py_DecodeUTF8_surrogateescape(arg, strlen(arg));
|
||||
if (size != NULL) {
|
||||
@@ -384,7 +384,7 @@
|
||||
char*
|
||||
_Py_wchar2char(const wchar_t *text, size_t *error_pos)
|
||||
{
|
||||
-#ifdef __APPLE__
|
||||
+#if defined(__APPLE__) || defined(__ANDROID__)
|
||||
Py_ssize_t len;
|
||||
PyObject *unicode, *bytes = NULL;
|
||||
char *cpath;
|
||||
diff -ru Python-3.3.5/Python/formatter_unicode.c Python-3.3.5-android/Python/formatter_unicode.c
|
||||
--- Python-3.3.5/Python/formatter_unicode.c 2014-03-09 09:40:32.000000000 +0100
|
||||
+++ Python-3.3.5-android/Python/formatter_unicode.c 2014-08-04 22:16:29.000000000 +0200
|
||||
@@ -665,6 +665,7 @@
|
||||
{
|
||||
switch (type) {
|
||||
case LT_CURRENT_LOCALE: {
|
||||
+#ifndef __ANDROID__
|
||||
struct lconv *locale_data = localeconv();
|
||||
locale_info->decimal_point = PyUnicode_DecodeLocale(
|
||||
locale_data->decimal_point,
|
||||
@@ -680,6 +681,7 @@
|
||||
}
|
||||
locale_info->grouping = locale_data->grouping;
|
||||
break;
|
||||
+#endif // __ANDROID__
|
||||
}
|
||||
case LT_DEFAULT_LOCALE:
|
||||
locale_info->decimal_point = PyUnicode_FromOrdinal('.');
|
||||
diff -ru Python-3.3.5/Python/pystrtod.c Python-3.3.5-android/Python/pystrtod.c
|
||||
--- Python-3.3.5/Python/pystrtod.c 2014-03-09 09:40:33.000000000 +0100
|
||||
+++ Python-3.3.5-android/Python/pystrtod.c 2014-08-04 22:16:29.000000000 +0200
|
||||
@@ -177,8 +177,12 @@
|
||||
|
||||
fail_pos = NULL;
|
||||
|
||||
+#ifdef __ANDROID__
|
||||
+ decimal_point = ".";
|
||||
+#else
|
||||
locale_data = localeconv();
|
||||
decimal_point = locale_data->decimal_point;
|
||||
+#endif
|
||||
decimal_point_len = strlen(decimal_point);
|
||||
|
||||
assert(decimal_point_len != 0);
|
||||
@@ -378,8 +382,12 @@
|
||||
Py_LOCAL_INLINE(void)
|
||||
change_decimal_from_locale_to_dot(char* buffer)
|
||||
{
|
||||
+#ifdef __ANDROID__
|
||||
+ const char *decimal_point = ".";
|
||||
+#else
|
||||
struct lconv *locale_data = localeconv();
|
||||
const char *decimal_point = locale_data->decimal_point;
|
||||
+#endif
|
||||
|
||||
if (decimal_point[0] != '.' || decimal_point[1] != 0) {
|
||||
size_t decimal_point_len = strlen(decimal_point);
|
||||
diff -ru Python-3.3.5/Python/pythonrun.c Python-3.3.5-android/Python/pythonrun.c
|
||||
--- Python-3.3.5/Python/pythonrun.c 2014-03-09 09:40:33.000000000 +0100
|
||||
+++ Python-3.3.5-android/Python/pythonrun.c 2014-08-04 22:16:29.000000000 +0200
|
||||
@@ -188,6 +188,8 @@
|
||||
return NULL;
|
||||
}
|
||||
return get_codec_name(codeset);
|
||||
+#elif __ANDROID__
|
||||
+ return get_codec_name("UTF-8");
|
||||
#else
|
||||
PyErr_SetNone(PyExc_NotImplementedError);
|
||||
return NULL;
|
||||
@@ -0,0 +1,326 @@
|
||||
diff -ru Python-3.3.5/Lib/platform.py Python-3.3.5-android/Lib/platform.py
|
||||
--- Python-3.3.5/Lib/platform.py 2014-03-09 09:40:13.000000000 +0100
|
||||
+++ Python-3.3.5-android/Lib/platform.py 2014-08-04 22:19:36.000000000 +0200
|
||||
@@ -368,6 +368,76 @@
|
||||
supported_dists=supported_dists,
|
||||
full_distribution_name=0)
|
||||
|
||||
+_android_environment_vars = (
|
||||
+ 'ANDROID_ROOT', 'ANDROID_ASSETS', 'ANDROID_STORAGE', 'ANDROID_DATA',
|
||||
+ 'ANDROID_PROPERTY_WORKSPACE', 'ANDROID_BOOTLOGO')
|
||||
+_android_version_property = 'ro.build.version.release'
|
||||
+_android_buildstr_property = 'ro.build.version.full'
|
||||
+
|
||||
+def android_version(version='', buildstr=''):
|
||||
+ """ Attempt to get the Android version number and build string.
|
||||
+
|
||||
+ The function checks for the getprop binary to retrieve build info,
|
||||
+ and falls back to manually reading /system/build.prop if available.
|
||||
+
|
||||
+ Returns a (version, buildstr) tuple which defaults to the args given
|
||||
+ as parameters.
|
||||
+ """
|
||||
+ if not any(os.getenv(e) for e in _android_environment_vars):
|
||||
+ # Probably not on Android...
|
||||
+ return version, buildstr
|
||||
+
|
||||
+ version_obtained = False
|
||||
+ buildstr_obtained = False
|
||||
+
|
||||
+ # Try the 'official' API tool first, since /system/build.prop might
|
||||
+ # not be the only source for properties.
|
||||
+ if os.access('/system/bin/getprop', os.X_OK):
|
||||
+ def _getprop(prop):
|
||||
+ android_property_fd = _get_android_property_fd()
|
||||
+ pass_fds = (android_property_fd,) if android_property_fd else ()
|
||||
+ try:
|
||||
+ result = subprocess.check_output(['/system/bin/getprop', prop],
|
||||
+ pass_fds=pass_fds)
|
||||
+ return result.decode('utf-8').strip()
|
||||
+ except (subprocess.CalledProcessError, UnicodeDecodeError):
|
||||
+ raise RuntimeError('getprop failed')
|
||||
+
|
||||
+ try:
|
||||
+ version = _getprop(_android_version_property)
|
||||
+ version_obtained = True
|
||||
+ except RuntimeError:
|
||||
+ pass
|
||||
+
|
||||
+ try:
|
||||
+ buildstr = _getprop(_android_buildstr_property)
|
||||
+ buildstr_obtained = True
|
||||
+ except RuntimeError:
|
||||
+ pass
|
||||
+ done = version_obtained and buildstr_obtained
|
||||
+
|
||||
+ # Fall back to parsing /system/build.prop manually.
|
||||
+ if not done and os.path.isfile('/system/build.prop'):
|
||||
+ for line in open('/system/build.prop', 'rb'):
|
||||
+ if b'=' not in line:
|
||||
+ continue
|
||||
+ key, val = line.split(b'=', maxsplit=1)
|
||||
+ key = key.strip().decode('utf-8')
|
||||
+
|
||||
+ if not version_obtained and key == _android_version_property:
|
||||
+ version = val.strip().decode('utf-8')
|
||||
+ if not buildstr_obtained and key == _android_buildstr_property:
|
||||
+ buildstr = val.strip().decode('utf-8')
|
||||
+
|
||||
+ return version, buildstr
|
||||
+
|
||||
+def _get_android_property_fd():
|
||||
+ android_property_workspace = os.getenv('ANDROID_PROPERTY_WORKSPACE')
|
||||
+ if android_property_workspace:
|
||||
+ property_fd_str = android_property_workspace.split(',')[0]
|
||||
+ if property_fd_str.isdigit():
|
||||
+ return int(property_fd_str)
|
||||
+
|
||||
def popen(cmd, mode='r', bufsize=-1):
|
||||
|
||||
""" Portable popen() interface.
|
||||
diff -ru Python-3.3.5/Lib/subprocess.py Python-3.3.5-android/Lib/subprocess.py
|
||||
--- Python-3.3.5/Lib/subprocess.py 2014-03-09 09:40:13.000000000 +0100
|
||||
+++ Python-3.3.5-android/Lib/subprocess.py 2014-08-04 22:19:36.000000000 +0200
|
||||
@@ -1343,9 +1343,18 @@
|
||||
args = list(args)
|
||||
|
||||
if shell:
|
||||
- args = ["/bin/sh", "-c"] + args
|
||||
if executable:
|
||||
- args[0] = executable
|
||||
+ main = executable
|
||||
+ elif os.path.isfile('/bin/sh'):
|
||||
+ main = '/bin/sh'
|
||||
+ else:
|
||||
+ import platform
|
||||
+ if platform.android_version()[0]:
|
||||
+ main = '/system/bin/sh'
|
||||
+ else:
|
||||
+ raise RuntimeError('Could not find system shell')
|
||||
+
|
||||
+ args = [main, "-c"] + args
|
||||
|
||||
if executable is None:
|
||||
executable = args[0]
|
||||
diff -ru Python-3.3.5/Lib/test/test_subprocess.py Python-3.3.5-android/Lib/test/test_subprocess.py
|
||||
--- Python-3.3.5/Lib/test/test_subprocess.py 2014-03-09 09:40:19.000000000 +0100
|
||||
+++ Python-3.3.5-android/Lib/test/test_subprocess.py 2014-08-04 22:19:36.000000000 +0200
|
||||
@@ -17,6 +17,7 @@
|
||||
import shutil
|
||||
import gc
|
||||
import textwrap
|
||||
+import platform
|
||||
|
||||
try:
|
||||
import resource
|
||||
@@ -1356,7 +1357,10 @@
|
||||
fd, fname = mkstemp()
|
||||
# reopen in text mode
|
||||
with open(fd, "w", errors="surrogateescape") as fobj:
|
||||
- fobj.write("#!/bin/sh\n")
|
||||
+ if platform.android_version()[0]:
|
||||
+ fobj.write('#!/system/bin/sh\n')
|
||||
+ else:
|
||||
+ fobj.write("#!/bin/sh\n")
|
||||
fobj.write("exec '%s' -c 'import sys; sys.exit(47)'\n" %
|
||||
sys.executable)
|
||||
os.chmod(fname, 0o700)
|
||||
@@ -1401,7 +1405,10 @@
|
||||
fd, fname = mkstemp()
|
||||
# reopen in text mode
|
||||
with open(fd, "w", errors="surrogateescape") as fobj:
|
||||
- fobj.write("#!/bin/sh\n")
|
||||
+ if platform.android_version()[0]:
|
||||
+ fobj.write('#!/system/bin/sh\n')
|
||||
+ else:
|
||||
+ fobj.write("#!/bin/sh\n")
|
||||
fobj.write("exec '%s' -c 'import sys; sys.exit(47)'\n" %
|
||||
sys.executable)
|
||||
os.chmod(fname, 0o700)
|
||||
diff -ru Python-3.4.2/Modules/pwdmodule.c Python-3.4.2-android/Modules/pwdmodule.c
|
||||
--- Python-3.4.2/Modules/pwdmodule.c 2015-02-24 23:06:31.000000000 +0100
|
||||
+++ Python-3.4.2-android/Modules/pwdmodule.c 2015-02-24 23:09:14.000000000 +0100
|
||||
@@ -72,7 +72,11 @@
|
||||
SETS(setIndex++, p->pw_passwd);
|
||||
PyStructSequence_SET_ITEM(v, setIndex++, _PyLong_FromUid(p->pw_uid));
|
||||
PyStructSequence_SET_ITEM(v, setIndex++, _PyLong_FromGid(p->pw_gid));
|
||||
+#if !defined(__ANDROID__)
|
||||
SETS(setIndex++, p->pw_gecos);
|
||||
+#else
|
||||
+ SETS(setIndex++, "");
|
||||
+#endif
|
||||
SETS(setIndex++, p->pw_dir);
|
||||
SETS(setIndex++, p->pw_shell);
|
||||
|
||||
diff -ru Python-3.3.5/Modules/socketmodule.c Python-3.3.5-android/Modules/socketmodule.c
|
||||
--- Python-3.3.5/Modules/socketmodule.c 2014-03-09 09:40:28.000000000 +0100
|
||||
+++ Python-3.3.5-android/Modules/socketmodule.c 2014-08-04 22:19:36.000000000 +0200
|
||||
@@ -150,7 +150,7 @@
|
||||
On the other hand, not all Linux versions agree, so there the settings
|
||||
computed by the configure script are needed! */
|
||||
|
||||
-#ifndef linux
|
||||
+#if !defined(linux) || __ANDROID__
|
||||
# undef HAVE_GETHOSTBYNAME_R_3_ARG
|
||||
# undef HAVE_GETHOSTBYNAME_R_5_ARG
|
||||
# undef HAVE_GETHOSTBYNAME_R_6_ARG
|
||||
@@ -169,7 +169,7 @@
|
||||
# define HAVE_GETHOSTBYNAME_R_3_ARG
|
||||
# elif defined(__sun) || defined(__sgi)
|
||||
# define HAVE_GETHOSTBYNAME_R_5_ARG
|
||||
-# elif defined(linux)
|
||||
+# elif defined(linux) && !__ANDROID__
|
||||
/* Rely on the configure script */
|
||||
# else
|
||||
# undef HAVE_GETHOSTBYNAME_R
|
||||
diff -ru Python-3.3.5/Modules/posixmodule.c Python-3.3.5-android/Modules/posixmodule.c
|
||||
--- Python-3.3.5/Modules/posixmodule.c 2014-03-09 08:40:28.000000000 +0000
|
||||
+++ Python-3.3.5-android/Modules/posixmodule.c 2015-02-24 19:57:05.368843433 +0000
|
||||
@@ -403,6 +403,11 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
+/* Android doesn't expose AT_EACCESS - manually define it. */
|
||||
+#if !defined(AT_EACCESS) && defined(__ANDROID__)
|
||||
+#define AT_EACCESS 0x200
|
||||
+#endif
|
||||
+
|
||||
|
||||
#ifdef MS_WINDOWS
|
||||
static int
|
||||
diff -ru Python-3.3.5/Python/pytime.c Python-3.3.5-android/Python/pytime.c
|
||||
--- Python-3.3.5/Python/pytime.c 2015-02-23 11:54:25.000000000 -0500
|
||||
+++ Python-3.3.5-android/Python/pytime.c 2015-02-23 11:55:19.000000000 -0500
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
-#if defined(__APPLE__) && defined(HAVE_GETTIMEOFDAY) && defined(HAVE_FTIME)
|
||||
+#if (defined(__APPLE__) || defined(__ANDROID__)) && defined(HAVE_GETTIMEOFDAY) && defined(HAVE_FTIME)
|
||||
/*
|
||||
* _PyTime_gettimeofday falls back to ftime when getttimeofday fails because the latter
|
||||
* might fail on some platforms. This fallback is unwanted on MacOSX because
|
||||
diff -ru Python-3.4.2/configure Python-3.4.2-android/configure
|
||||
--- Python-3.4.2/configure 2015-02-24 23:18:31.000000000 +0100
|
||||
+++ Python-3.4.2-android/configure 2015-03-01 20:15:02.000000000 +0100
|
||||
@@ -5406,6 +5406,34 @@
|
||||
MULTIARCH=$($CC --print-multiarch 2>/dev/null)
|
||||
|
||||
|
||||
+# Test if we're running on Android.
|
||||
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if target is Android-based" >&5
|
||||
+$as_echo_n "checking if target is Android-based... " >&6; }
|
||||
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
+/* end confdefs.h. */
|
||||
+
|
||||
+#if __ANDROID__
|
||||
+yes
|
||||
+#endif
|
||||
+
|
||||
+_ACEOF
|
||||
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
|
||||
+ $EGREP "yes" >/dev/null 2>&1; then :
|
||||
+
|
||||
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
+$as_echo "yes" >&6; }
|
||||
+ with_android=yes
|
||||
+
|
||||
+else
|
||||
+
|
||||
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
+$as_echo "no" >&6; }
|
||||
+ with_android=no
|
||||
+
|
||||
+
|
||||
+fi
|
||||
+rm -f conftest*
|
||||
+
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking LIBRARY" >&5
|
||||
@@ -5650,7 +5678,14 @@
|
||||
SOVERSION=`echo $SOVERSION|cut -d "." -f 1`
|
||||
;;
|
||||
esac
|
||||
- INSTSONAME="$LDLIBRARY".$SOVERSION
|
||||
+
|
||||
+ if test "$with_android" != yes
|
||||
+ then
|
||||
+ INSTSONAME="$LDLIBRARY".$SOVERSION
|
||||
+ else
|
||||
+ INSTSONAME="$LDLIBRARY"
|
||||
+ fi
|
||||
+
|
||||
if test "$with_pydebug" != yes
|
||||
then
|
||||
PY3LIBRARY=libpython3.so
|
||||
diff -ru Python-3.4.2/configure.ac Python-3.4.2-android/configure.ac
|
||||
--- Python-3.4.2/configure.ac 2015-02-24 23:18:31.000000000 +0100
|
||||
+++ Python-3.4.2-android/configure.ac 2015-03-01 20:14:54.000000000 +0100
|
||||
@@ -796,6 +796,21 @@
|
||||
MULTIARCH=$($CC --print-multiarch 2>/dev/null)
|
||||
AC_SUBST(MULTIARCH)
|
||||
|
||||
+# Test if we're running on Android.
|
||||
+AC_MSG_CHECKING(if target is Android-based)
|
||||
+AC_EGREP_CPP(yes,
|
||||
+[
|
||||
+#if __ANDROID__
|
||||
+yes
|
||||
+#endif
|
||||
+], [
|
||||
+ AC_MSG_RESULT(yes)
|
||||
+ with_android=yes
|
||||
+ ], [
|
||||
+ AC_MSG_RESULT(no)
|
||||
+ with_android=no
|
||||
+ ]
|
||||
+)
|
||||
|
||||
AC_SUBST(LIBRARY)
|
||||
AC_MSG_CHECKING(LIBRARY)
|
||||
@@ -970,7 +985,14 @@
|
||||
SOVERSION=`echo $SOVERSION|cut -d "." -f 1`
|
||||
;;
|
||||
esac
|
||||
- INSTSONAME="$LDLIBRARY".$SOVERSION
|
||||
+
|
||||
+ if test "$with_android" != yes
|
||||
+ then
|
||||
+ INSTSONAME="$LDLIBRARY".$SOVERSION
|
||||
+ else
|
||||
+ INSTSONAME="$LDLIBRARY"
|
||||
+ fi
|
||||
+
|
||||
if test "$with_pydebug" != yes
|
||||
then
|
||||
PY3LIBRARY=libpython3.so
|
||||
|
||||
diff -ru Python-3.4.2/Makefile.pre.in Python-3.4.2-android/Makefile.pre.in
|
||||
--- Python-3.4.2/Makefile.pre.in 2015-03-04 16:25:36.000000000 +0100
|
||||
+++ Python-3.4.2-android/Makefile.pre.in 2015-03-04 16:27:27.000000000 +0100
|
||||
@@ -568,7 +568,7 @@
|
||||
*\ -s*|s*) quiet="-q";; \
|
||||
*) quiet="";; \
|
||||
esac; \
|
||||
- $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
|
||||
+ $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED) -lpython$(LDVERSION)' OPT='$(OPT)' \
|
||||
_TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
|
||||
$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
|
||||
|
||||
diff -Nru Python-3.4.2/Makefile.pre.in Python-3.4.2-android/Makefile.pre.in
|
||||
--- Python-3.4.2/Makefile.pre.in 2015-06-27 17:04:23.885777456 +0000
|
||||
+++ Python-3.4.2-android/Makefile.pre.in 2015-06-27 17:05:27.709777315 +0000
|
||||
@@ -585,11 +585,9 @@
|
||||
$(RANLIB) $@
|
||||
|
||||
libpython$(LDVERSION).so: $(LIBRARY_OBJS)
|
||||
+ $(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
|
||||
if test $(INSTSONAME) != $(LDLIBRARY); then \
|
||||
- $(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
|
||||
$(LN) -f $(INSTSONAME) $@; \
|
||||
- else \
|
||||
- $(BLDSHARED) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
|
||||
fi
|
||||
|
||||
libpython3.so: libpython$(LDVERSION).so
|
||||
@@ -0,0 +1,17 @@
|
||||
diff -ru Python-3.3.5/Modules/_posixsubprocess.c Python-3.3.5-android/Modules/_posixsubprocess.c
|
||||
--- Python-3.3.5/Modules/_posixsubprocess.c 2014-03-09 09:40:26.000000000 +0100
|
||||
+++ Python-3.3.5-android/Modules/_posixsubprocess.c 2014-08-04 22:19:36.000000000 +0200
|
||||
@@ -18,6 +18,12 @@
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
||||
+#if defined(__ANDROID__)
|
||||
+/* Android doesn't expose syscalls. Let's add the definition manually. */
|
||||
+# include <sys/linux-syscalls.h>
|
||||
+# define SYS_getdents64 __NR_getdents64
|
||||
+#endif
|
||||
+
|
||||
#if defined(sun)
|
||||
/* readdir64 is used to work around Solaris 9 bug 6395699. */
|
||||
# define readdir readdir64
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
diff -ru Python-3.3.5/Makefile.pre.in Python-3.3.5-android/Makefile.pre.in
|
||||
--- Python-3.3.5/Makefile.pre.in 2014-03-09 09:40:23.000000000 +0100
|
||||
+++ Python-3.3.5-android/Makefile.pre.in 2014-08-04 22:13:00.000000000 +0200
|
||||
@@ -674,7 +674,7 @@
|
||||
$(GRAMMAR_H): $(GRAMMAR_INPUT) $(PGENSRCS)
|
||||
@$(MKDIR_P) Include
|
||||
$(MAKE) $(PGEN)
|
||||
- $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
|
||||
+ $(HOSTPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
|
||||
$(GRAMMAR_C): $(GRAMMAR_H) $(GRAMMAR_INPUT) $(PGENSRCS)
|
||||
$(MAKE) $(GRAMMAR_H)
|
||||
touch $(GRAMMAR_C)
|
||||
@@ -1243,6 +1243,7 @@
|
||||
# Install the dynamically loadable modules
|
||||
# This goes into $(exec_prefix)
|
||||
sharedinstall: sharedmods
|
||||
+ CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(LDFLAGS)' OPT='$(OPT)' CROSS_COMPILE='$(CROSS_COMPILE)' \
|
||||
$(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
|
||||
--prefix=$(prefix) \
|
||||
--install-scripts=$(BINDIR) \
|
||||
diff -ru Python-3.3.5/configure Python-3.3.5-android/configure
|
||||
--- Python-3.3.5/configure 2014-03-09 09:40:34.000000000 +0100
|
||||
+++ Python-3.3.5-android/configure 2014-08-04 22:13:00.000000000 +0200
|
||||
@@ -2943,13 +2943,18 @@
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for python interpreter for cross build" >&5
|
||||
$as_echo_n "checking for python interpreter for cross build... " >&6; }
|
||||
if test -z "$PYTHON_FOR_BUILD"; then
|
||||
- for interp in python$PACKAGE_VERSION python3 python; do
|
||||
- which $interp >/dev/null 2>&1 || continue
|
||||
- if $interp -c 'import sys;sys.exit(not sys.version_info[:2] >= (3,3))'; then
|
||||
- break
|
||||
- fi
|
||||
- interp=
|
||||
- done
|
||||
+ if test ! -z "$HOSTPYTHON" && PYTHONPATH="$ac_abs_confdir/Lib" "$HOSTPYTHON" -S -c 'import sys;sys.exit(not sys.version_info[:2] >= (3,3))'; then
|
||||
+ interp="$HOSTPYTHON"
|
||||
+ else
|
||||
+ for interp in python$PACKAGE_VERSION python3 python; do
|
||||
+ which $interp >/dev/null 2>&1 || continue
|
||||
+ if $interp -c 'import sys;sys.exit(not sys.version_info[:2] >= (3,3))'; then
|
||||
+ break
|
||||
+ fi
|
||||
+ interp=
|
||||
+ done
|
||||
+ fi
|
||||
+
|
||||
if test x$interp = x; then
|
||||
as_fn_error $? "python$PACKAGE_VERSION interpreter not found" "$LINENO" 5
|
||||
fi
|
||||
diff -ru Python-3.3.5/configure.ac Python-3.3.5-android/configure.ac
|
||||
--- Python-3.3.5/configure.ac 2014-03-09 09:40:34.000000000 +0100
|
||||
+++ Python-3.3.5-android/configure.ac 2014-08-04 22:13:00.000000000 +0200
|
||||
@@ -56,13 +56,18 @@
|
||||
if test "$cross_compiling" = yes; then
|
||||
AC_MSG_CHECKING([for python interpreter for cross build])
|
||||
if test -z "$PYTHON_FOR_BUILD"; then
|
||||
- for interp in python$PACKAGE_VERSION python3 python; do
|
||||
- which $interp >/dev/null 2>&1 || continue
|
||||
- if $interp -c 'import sys;sys.exit(not sys.version_info@<:@:2@:>@ >= (3,3))'; then
|
||||
- break
|
||||
- fi
|
||||
- interp=
|
||||
- done
|
||||
+ if test ! -z "$HOSTPYTHON" && PYTHONPATH="$ac_abs_confdir/Lib" "$HOSTPYTHON" -S -c 'import sys;sys.exit(not sys.version_info@<:@:2@:>@ >= (3,3))'; then
|
||||
+ interp="$HOSTPYTHON"
|
||||
+ else
|
||||
+ for interp in python$PACKAGE_VERSION python3 python; do
|
||||
+ which $interp >/dev/null 2>&1 || continue
|
||||
+ if $interp -c 'import sys;sys.exit(not sys.version_info@<:@:2@:>@ >= (3,3))'; then
|
||||
+ break
|
||||
+ fi
|
||||
+ interp=
|
||||
+ done
|
||||
+ fi
|
||||
+
|
||||
if test x$interp = x; then
|
||||
AC_MSG_ERROR([python$PACKAGE_VERSION interpreter not found])
|
||||
fi
|
||||
@@ -0,0 +1,96 @@
|
||||
diff -ru Python-3.3.5/Lib/test/test_pwd.py Python-3.3.5-android/Lib/test/test_pwd.py
|
||||
--- Python-3.3.5/Lib/test/test_pwd.py 2014-03-09 09:40:19.000000000 +0100
|
||||
+++ Python-3.3.5-android/Lib/test/test_pwd.py 2014-08-04 22:14:36.000000000 +0200
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
class PwdTest(unittest.TestCase):
|
||||
|
||||
+ @unittest.skipUnless(hasattr(pwd, 'getpwall'), 'pwd module does not expose getpwall()')
|
||||
def test_values(self):
|
||||
entries = pwd.getpwall()
|
||||
|
||||
@@ -52,6 +53,7 @@
|
||||
self.assertIn(pwd.getpwnam(e.pw_name), entriesbyname[e.pw_name])
|
||||
self.assertIn(pwd.getpwuid(e.pw_uid), entriesbyuid[e.pw_uid])
|
||||
|
||||
+ @unittest.skipUnless(hasattr(pwd, 'getpwall'), 'pwd module does not expose getpwall()')
|
||||
def test_errors(self):
|
||||
self.assertRaises(TypeError, pwd.getpwuid)
|
||||
self.assertRaises(TypeError, pwd.getpwuid, 3.14)
|
||||
diff -ru Python-3.4.2/Modules/python.c Python-3.4.2-android/Modules/python.c
|
||||
--- Python-3.4.2/Modules/python.c 2015-02-24 22:42:37.000000000 +0100
|
||||
+++ Python-3.4.2-android/Modules/python.c 2015-02-24 23:04:27.000000000 +0100
|
||||
@@ -44,10 +44,13 @@
|
||||
fpsetmask(m & ~FP_X_OFL);
|
||||
#endif
|
||||
|
||||
- oldloc = _PyMem_RawStrdup(setlocale(LC_ALL, NULL));
|
||||
- if (!oldloc) {
|
||||
- fprintf(stderr, "out of memory\n");
|
||||
- return 1;
|
||||
+ oldloc = setlocale(LC_ALL, NULL);
|
||||
+ if (oldloc) {
|
||||
+ oldloc = _PyMem_RawStrdup(oldloc);
|
||||
+ if (!oldloc) {
|
||||
+ fprintf(stderr, "out of memory\n");
|
||||
+ return 1;
|
||||
+ }
|
||||
}
|
||||
|
||||
setlocale(LC_ALL, "");
|
||||
@@ -64,8 +67,11 @@
|
||||
}
|
||||
argv_copy2[argc] = argv_copy[argc] = NULL;
|
||||
|
||||
- setlocale(LC_ALL, oldloc);
|
||||
- PyMem_RawFree(oldloc);
|
||||
+ if (oldloc) {
|
||||
+ setlocale(LC_ALL, oldloc);
|
||||
+ PyMem_RawFree(oldloc);
|
||||
+ }
|
||||
+
|
||||
res = Py_Main(argc, argv_copy);
|
||||
for (i = 0; i < argc; i++) {
|
||||
PyMem_RawFree(argv_copy2[i]);
|
||||
diff -ru Python-3.3.5/setup.py Python-3.3.5-android/setup.py
|
||||
--- Python-3.3.5/setup.py 2014-03-09 09:40:35.000000000 +0100
|
||||
+++ Python-3.3.5-android/setup.py 2014-08-04 22:14:36.000000000 +0200
|
||||
@@ -562,7 +562,7 @@
|
||||
libraries=math_libs) )
|
||||
|
||||
# time libraries: librt may be needed for clock_gettime()
|
||||
- time_libs = []
|
||||
+ time_libs = ['m']
|
||||
lib = sysconfig.get_config_var('TIMEMODULE_LIB')
|
||||
if lib:
|
||||
time_libs.append(lib)
|
||||
@@ -631,7 +631,8 @@
|
||||
missing.append('spwd')
|
||||
|
||||
# select(2); not on ancient System V
|
||||
- exts.append( Extension('select', ['selectmodule.c']) )
|
||||
+ exts.append( Extension('select', ['selectmodule.c'],
|
||||
+ libraries=['m']) )
|
||||
|
||||
# Fred Drake's interface to the Python parser
|
||||
exts.append( Extension('parser', ['parsermodule.c']) )
|
||||
@@ -639,7 +639,8 @@
|
||||
# Operations on audio samples
|
||||
# According to #993173, this one should actually work fine on
|
||||
# 64-bit platforms.
|
||||
- exts.append( Extension('audioop', ['audioop.c']) )
|
||||
+ exts.append( Extension('audioop', ['audioop.c'],
|
||||
+ libraries=['m']) )
|
||||
|
||||
# readline
|
||||
do_readline = self.compiler.find_library_file(lib_dirs, 'readline')
|
||||
@@ -1904,7 +1905,8 @@
|
||||
sources=sources,
|
||||
depends=depends)
|
||||
ext_test = Extension('_ctypes_test',
|
||||
- sources=['_ctypes/_ctypes_test.c'])
|
||||
+ sources=['_ctypes/_ctypes_test.c'],
|
||||
+ libraries=['m'])
|
||||
self.extensions.extend([ext, ext_test])
|
||||
|
||||
if not '--with-system-ffi' in sysconfig.get_config_var("CONFIG_ARGS"):
|
||||
1
project/jni/python3/mk/python/3.4.3/sources.txt
Normal file
1
project/jni/python3/mk/python/3.4.3/sources.txt
Normal file
@@ -0,0 +1 @@
|
||||
https://python.org/ftp/python/3.4.3/Python-3.4.3.tar.xz
|
||||
Reference in New Issue
Block a user