Skip to content

Commit

Permalink
update to 3.8.10
Browse files Browse the repository at this point in the history
  • Loading branch information
pmp-p committed May 16, 2021
1 parent e4576b9 commit 8a058a8
Show file tree
Hide file tree
Showing 99 changed files with 2,715 additions and 31 deletions.
26 changes: 15 additions & 11 deletions pydk-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,28 @@ else
echo "not bash, those previously rising errors are ash/sh/dash/... flavours"
fi

PYMINOR_DEFAULT=9
PYMINOR_DEFAULT=8
PYMICRO=10

PYMINOR_DEFAULT=7
PYMICRO=10

export PYMAJOR=3
export PYMINOR=${PYMINOR:-$PYMINOR_DEFAULT}
export PYVER=${PYMAJOR}.${PYMINOR}.${PYMICRO}

if echo $PYMINOR |grep -q 7
#echo $PYMINOR |grep -q 7
if false
then
# python 3.7.x
export PYVER=${PYMAJOR}.${PYMINOR}.7
# python 3.7.x
export OPENSSL_VERSION="1.0.2t"
else
# python 3.8.x / 3.9.x
#export PYVER=${PYMAJOR}.${PYMINOR}.5
export PYVER=${PYMAJOR}.${PYMINOR}.1
# python 3.8.x / 3.9.x
export OPENSSL_VERSION="1.1.1h"
fi

export LIBFFI_VERSION=3.3


export HOST_TRIPLET=x86_64-linux-gnu
export HOST_TAG=linux-x86_64

Expand All @@ -54,7 +56,6 @@ export HOME=${PYTHONPYCACHEPREFIX}
#UNITS="unit"
UNITS=""


# select a place for android build
export ENV=aosp
ROOT="${ORIGIN}/${ENV}"
Expand Down Expand Up @@ -280,6 +281,9 @@ if [ -f CMakeLists.txt ]
then
echo " * using previous CMakeLists.txt in $(pwd)"
else

# TODO: check wasm/wasi cmake + CMAKE_CACHE_ARGS "-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=true"

cat > CMakeLists.txt <<END
cmake_minimum_required(VERSION 3.13.0)
Expand Down Expand Up @@ -729,7 +733,7 @@ export TOOLCHAIN="${ORIGIN}/emsdk/emsdk_env.sh"
. $TOOLCHAIN
export PATH="$EMSDK/upstream/emscripten:$BASEPATH"

export WCMAKE="emcmake $CMAKE -Wno-dev -DCMAKE_INSTALL_PREFIX=${APKUSR}"
export WCMAKE="emcmake $CMAKE -DCMAKE_POSITION_INDEPENDENT_CODE=ON -Wno-dev -DCMAKE_INSTALL_PREFIX=${APKUSR}"

cat > ${HOST}/${ABI_NAME}.sh <<END
#!/bin/sh
Expand Down Expand Up @@ -834,7 +838,7 @@ then
then
echo "emsdk libs ready"
else
ALL="struct_info zlib bzip2 freetype harfbuzz ogg vorbis libpng bullet"
ALL="struct_info libfetch zlib bzip2 freetype harfbuzz ogg vorbis libpng bullet"
for one in $ALL
do
embuilder --pic build $one
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
--- Python-3.7.10/Lib/importlib/_bootstrap_external.py 2021-02-16 02:29:22.000000000 +0100
+++ Python-3.7.10-aosp/Lib/importlib/_bootstrap_external.py 2021-03-04 15:06:27.752072064 +0100
@@ -1315,6 +1315,7 @@
refreshed when the directory the finder is handling has been modified.

"""
+ PATCHED = 1

def __init__(self, path, *loader_details):
"""Initialize with the path to search on and a variable number of
@@ -1386,9 +1387,14 @@
# If a namespace package, return the path if we don't
# find a module in the next section.
is_namespace = _path_isdir(base_path)
+
# Check for a file w/ a proper suffix exists.
for suffix, loader_class in self._loaders:
full_path = _path_join(self.path, tail_module + suffix)
+ try:
+ print("1394: trying", full_path)
+ except:
+ pass
_bootstrap._verbose_message('trying {}', full_path, verbosity=2)
if cache_module + suffix in cache:
if _path_isfile(full_path):
23 changes: 23 additions & 0 deletions sources.aosp/Python-3.7.10/Lib_locale.py.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--- Python-3.7.10/Lib/locale.py 2021-02-16 02:29:22.000000000 +0100
+++ Python-3.7.10-aosp/Lib/locale.py 2021-03-04 15:06:27.760071792 +0100
@@ -46,6 +46,10 @@

from _locale import *

+ if hasattr(sys, 'getandroidapilevel'):
+ if sys.getandroidapilevel()<21:
+ raise ImportError("android-api19")
+
except ImportError:

# Locale emulation
@@ -88,6 +92,9 @@
""" setlocale(integer,string=None) -> string.
Activates/queries locale processing.
"""
+ if category>LC_ALL:
+ raise Error('_locale emulation invalid category')
+
if value not in (None, '', 'C'):
raise Error('_locale emulation only supports "C" locale')
return 'C'
31 changes: 31 additions & 0 deletions sources.aosp/Python-3.7.10/Lib_modulefinder.py.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
--- Python-3.7.10/Lib/modulefinder.py 2021-02-16 02:29:22.000000000 +0100
+++ Python-3.7.10-aosp/Lib/modulefinder.py 2021-03-04 15:06:27.764071657 +0100
@@ -185,8 +185,8 @@
if q:
self.msgout(4, "find_head_package ->", (q, tail))
return q, tail
- self.msgout(4, "raise ImportError: No module named", qname)
- raise ImportError("No module named " + qname)
+ self.msgout(4, "raise ImportError: No module named1", qname)
+ raise ImportError("No module named1 " + qname)

def load_tail(self, q, tail):
self.msgin(4, "load_tail", q, tail)
@@ -199,7 +199,7 @@
m = self.import_module(head, mname, m)
if not m:
self.msgout(4, "raise ImportError: No module named", mname)
- raise ImportError("No module named " + mname)
+ raise ImportError("No module named2 " + mname)
self.msgout(4, "load_tail ->", m)
return m

@@ -215,7 +215,7 @@
subname = "%s.%s" % (m.__name__, sub)
submod = self.import_module(sub, subname, m)
if not submod:
- raise ImportError("No module named " + subname)
+ raise ImportError("No module named3 " + subname)

def find_all_submodules(self, m):
if not m.__path__:
12 changes: 12 additions & 0 deletions sources.aosp/Python-3.7.10/Lib_platform.py.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- Python-3.7.10/Lib/platform.py 2021-02-16 02:29:22.000000000 +0100
+++ Python-3.7.10-aosp/Lib/platform.py 2021-03-04 15:06:27.768071521 +0100
@@ -188,6 +188,9 @@
The file is read and scanned in chunks of chunksize bytes.

"""
+ if hasattr(sys, 'getandroidapilevel'):
+ return 'libc', f'{sys.getandroidapilevel()}-bionic'
+
V = _comparable_version
if hasattr(os.path, 'realpath'):
# Python 2.2 introduced os.path.realpath(); it is used
11 changes: 11 additions & 0 deletions sources.aosp/Python-3.7.10/Lib_runpy.py.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- Python-3.7.10/Lib/runpy.py 2021-02-16 02:29:22.000000000 +0100
+++ Python-3.7.10-aosp/Lib/runpy.py 2021-03-04 15:06:27.772071386 +0100
@@ -133,7 +133,7 @@
msg = "Error while finding module specification for {!r} ({}: {})"
raise error(msg.format(mod_name, type(ex).__name__, ex)) from ex
if spec is None:
- raise error("No module named %s" % mod_name)
+ raise error("No module named5 %s" % mod_name)
if spec.submodule_search_locations is not None:
if mod_name == "__main__" or mod_name.endswith(".__main__"):
raise error("Cannot use package as __main__ module")
18 changes: 18 additions & 0 deletions sources.aosp/Python-3.7.10/Lib_test_test_zlib.py.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
--- Python-3.7.10/Lib/test/test_zlib.py 2021-02-16 02:29:22.000000000 +0100
+++ Python-3.7.10-aosp/Lib/test/test_zlib.py 2021-03-04 15:06:27.776071250 +0100
@@ -437,7 +437,14 @@
sync_opt = ['Z_NO_FLUSH', 'Z_SYNC_FLUSH', 'Z_FULL_FLUSH',
'Z_PARTIAL_FLUSH']

- ver = tuple(int(v) for v in zlib.ZLIB_RUNTIME_VERSION.split('.'))
+ v = zlib.ZLIB_RUNTIME_VERSION.split('-', 1)[0].split('.')
+ if len(v) < 4:
+ v.append('0')
+ elif not v[-1].isnumeric():
+ v[-1] = '0'
+
+ ver = tuple(map(int, v))
+
# Z_BLOCK has a known failure prior to 1.2.5.3
if ver >= (1, 2, 5, 3):
sync_opt.append('Z_BLOCK')
11 changes: 11 additions & 0 deletions sources.aosp/Python-3.7.10/Makefile.pre.in.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- Python-3.7.10/Makefile.pre.in 2021-02-16 02:29:22.000000000 +0100
+++ Python-3.7.10-aosp/Makefile.pre.in 2021-03-04 15:06:27.780071115 +0100
@@ -226,7 +226,7 @@
PY3LIBRARY= @PY3LIBRARY@
DLLLIBRARY= @DLLLIBRARY@
LDLIBRARYDIR= @LDLIBRARYDIR@
-INSTSONAME= @INSTSONAME@
+INSTSONAME= libpython$(LDVERSION).so


LIBS= @LIBS@
19 changes: 19 additions & 0 deletions sources.aosp/Python-3.7.10/Modules__decimal_libmpdec_io.c.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--- Python-3.7.10/Modules/_decimal/libmpdec/io.c 2021-02-16 02:29:22.000000000 +0100
+++ Python-3.7.10-aosp/Modules/_decimal/libmpdec/io.c 2021-03-04 15:06:27.784070980 +0100
@@ -871,9 +871,15 @@
if (*spec->sep) {
return 0;
}
+
spec->type = *cp++;
spec->type = (spec->type == 'N') ? 'G' : 'g';
- lc = localeconv();
+#if __ANDROID__ && (__ANDROID_API__ < 21)
+ #warning "====================================== broken_localeconv ================================"
+ lc = broken_localeconv();
+#else
+ lc = localeconv(); //PATCHED
+#endif
spec->dot = lc->decimal_point;
spec->sep = lc->thousands_sep;
spec->grouping = lc->grouping;
31 changes: 31 additions & 0 deletions sources.aosp/Python-3.7.10/Modules__localemodule.c.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
--- Python-3.7.10/Modules/_localemodule.c 2021-02-16 02:29:22.000000000 +0100
+++ Python-3.7.10-aosp/Modules/_localemodule.c 2021-03-04 15:06:27.788070843 +0100
@@ -96,6 +96,10 @@
PyErr_SetString(Error, "invalid locale category");
return NULL;
}
+#else
+#ifdef __ANDROID__
+ return PyUnicode_FromFormat("%s", "C");
+#endif
#endif

if (locale) {
@@ -213,7 +217,16 @@
}

/* if LC_NUMERIC is different in the C library, use saved value */
- l = localeconv();
+//PMPP API<21
+#if __ANDROID__ && (__ANDROID_API__ < 21)
+ /* Don't even try on Android's broken locale.h. */
+ /* maybe can use c++ stdlib to implement */
+ l = broken_localeconv();
+#else
+ /* if LC_NUMERIC is different in the C library, use saved value */
+ l = localeconv(); //PATCHED
+#endif
+//PMPP API<21

/* hopefully, the localeconv result survives the C library calls
involved herein */
35 changes: 35 additions & 0 deletions sources.aosp/Python-3.7.10/Modules_main.c.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
--- Python-3.7.10/Modules/main.c 2021-02-16 02:29:22.000000000 +0100
+++ Python-3.7.10-aosp/Modules/main.c 2021-03-04 15:06:27.792070707 +0100
@@ -62,6 +62,14 @@
#define WCSTOK wcstok
#endif

+//PMPP API<21
+#ifdef __ANDROID__
+ #if __ANDROID_API__ < 21
+ #define NO_LOCALECONV 1
+ #endif
+#endif
+//PMPP API<21
+
/* For Py_GetArgcArgv(); set by main() */
static wchar_t **orig_argv = NULL;
static int orig_argc = 0;
@@ -2095,13 +2103,15 @@
int init_utf8_mode = Py_UTF8Mode;
_PyCoreConfig save_config = _PyCoreConfig_INIT;
int res = -1;
-
+#if NO_LOCALECONV
+ char *oldloc = NULL;
+#else
char *oldloc = _PyMem_RawStrdup(setlocale(LC_ALL, NULL));
if (oldloc == NULL) {
pymain->err = _Py_INIT_NO_MEMORY();
goto done;
}
-
+#endif
/* Reconfigure the locale to the default for this process */
_Py_SetLocaleFromEnv(LC_ALL);

15 changes: 15 additions & 0 deletions sources.aosp/Python-3.7.10/Modules_mmapmodule.c.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
--- Python-3.7.10/Modules/mmapmodule.c 2021-02-16 02:29:22.000000000 +0100
+++ Python-3.7.10-aosp/Modules/mmapmodule.c 2021-03-04 15:06:27.796070572 +0100
@@ -79,6 +79,12 @@
# define MAP_ANONYMOUS MAP_ANON
#endif

+//PMPP API<21
+#if __ANDROID_API__ < 21
+ extern void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
+#endif
+//PMPP API<21
+
typedef enum
{
ACCESS_DEFAULT,
Loading

0 comments on commit 8a058a8

Please sign in to comment.