-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
99 changed files
with
2,715 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
sources.aosp/Python-3.7.10/Lib_importlib__bootstrap_external.py.diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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__: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
19
sources.aosp/Python-3.7.10/Modules__decimal_libmpdec_io.c.diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
Oops, something went wrong.