Skip to content

Commit 27130b2

Browse files
committed
python: update to 3.11.4
1 parent 4ebd3a8 commit 27130b2

File tree

8 files changed

+51
-33
lines changed

8 files changed

+51
-33
lines changed

pythonforandroid/bootstraps/common/build/src/main/java/org/kivy/android/PythonUtil.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ protected static ArrayList<String> getLibraries(File libsDir) {
5555
libsList.add("python3.8");
5656
libsList.add("python3.9");
5757
libsList.add("python3.10");
58+
libsList.add("python3.11");
5859
libsList.add("main");
5960
return libsList;
6061
}
@@ -74,7 +75,7 @@ public static void loadLibraries(File filesDir, File libsDir) {
7475
// load, and it has failed, give a more
7576
// general error
7677
Log.v(TAG, "Library loading error: " + e.getMessage());
77-
if (lib.startsWith("python3.10") && !foundPython) {
78+
if (lib.startsWith("python3.11") && !foundPython) {
7879
throw new RuntimeException("Could not load any libpythonXXX.so");
7980
} else if (lib.startsWith("python")) {
8081
continue;

pythonforandroid/recipes/hostpython3/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class HostPython3Recipe(Recipe):
3535
:class:`~pythonforandroid.python.HostPythonRecipe`
3636
'''
3737

38-
version = '3.10.10'
38+
version = '3.11.4'
3939
name = 'hostpython3'
4040

4141
build_subdir = 'native-build'
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
diff -Nru Python-3.8.2/Lib/site.py Python-3.8.2-new/Lib/site.py
2-
--- Python-3.8.2/Lib/site.py 2020-04-28 12:48:38.000000000 -0700
3-
+++ Python-3.8.2-new/Lib/site.py 2020-04-28 12:52:46.000000000 -0700
4-
@@ -487,7 +487,8 @@
1+
--- Python-3.11.4/Lib/site.py 2023-06-07 03:30:27.000000000 +0530
2+
+++ Python-3.11.4.mod/Lib/site.py 2023-07-08 11:31:15.088734501 +0530
3+
@@ -523,8 +523,7 @@
54
if key == 'include-system-site-packages':
65
system_site = value.lower()
76
elif key == 'home':
87
- sys._home = value
9-
+ # this is breaking pyconfig.h path detection with venv
8+
-
109
+ print('Ignoring "sys._home = value" override', file=sys.stderr)
11-
1210
sys.prefix = sys.exec_prefix = site_prefix
1311

12+
# Doing this here ensures venv takes precedence over user-site

pythonforandroid/recipes/python3/__init__.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class Python3Recipe(TargetPythonRecipe):
5656
:class:`~pythonforandroid.python.GuestPythonRecipe`
5757
'''
5858

59-
version = '3.10.10'
59+
version = '3.11.4'
6060
url = 'https://www.python.org/ftp/python/{version}/Python-{version}.tgz'
6161
name = 'python3'
6262

@@ -79,7 +79,8 @@ class Python3Recipe(TargetPythonRecipe):
7979
("patches/py3.7.1_fix_cortex_a8.patch", version_starts_with("3.7")),
8080
("patches/py3.8.1_fix_cortex_a8.patch", version_starts_with("3.8")),
8181
("patches/py3.8.1_fix_cortex_a8.patch", version_starts_with("3.9")),
82-
("patches/py3.8.1_fix_cortex_a8.patch", version_starts_with("3.10"))
82+
("patches/py3.8.1_fix_cortex_a8.patch", version_starts_with("3.10")),
83+
("patches/py3.11.4_fix_cortex_a8.patch", version_starts_with("3.11"))
8384
]
8485

8586
depends = ['hostpython3', 'sqlite3', 'openssl', 'libffi']
@@ -92,6 +93,7 @@ class Python3Recipe(TargetPythonRecipe):
9293
configure_args = (
9394
'--host={android_host}',
9495
'--build={android_build}',
96+
'--with-build-python={python_host_bin}',
9597
'--enable-shared',
9698
'--enable-ipv6',
9799
'ac_cv_file__dev_ptmx=yes',
@@ -101,7 +103,8 @@ class Python3Recipe(TargetPythonRecipe):
101103
'ac_cv_header_sys_eventfd_h=no',
102104
'--prefix={prefix}',
103105
'--exec-prefix={exec_prefix}',
104-
'--enable-loadable-sqlite-extensions')
106+
'--enable-loadable-sqlite-extensions'
107+
)
105108
'''The configure arguments needed to build the python recipe. Those are
106109
used in method :meth:`build_arch` (if not overwritten like python3's
107110
recipe does).
@@ -323,6 +326,9 @@ def build_arch(self, arch):
323326
*(' '.join(self.configure_args).format(
324327
android_host=env['HOSTARCH'],
325328
android_build=android_build,
329+
python_host_bin=join(self.get_recipe(
330+
'host' + self.name, self.ctx
331+
).get_path_to_python(), "bin", "python3"),
326332
prefix=sys_prefix,
327333
exec_prefix=sys_exec_prefix)).split(' '),
328334
_env=env)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- Python-3.11.4/configure 2023-06-07 03:30:27.000000000 +0530
2+
+++ Python-3.11.4.mod/configure 2023-07-08 11:51:11.031135937 +0530
3+
@@ -6994,7 +6994,7 @@
4+
printf "%s\n" "$_arm_arch" >&6; }
5+
if test "$_arm_arch" = 7; then
6+
BASECFLAGS="${BASECFLAGS} -mfloat-abi=softfp -mfpu=vfpv3-d16"
7+
- LDFLAGS="${LDFLAGS} -march=armv7-a -Wl,--fix-cortex-a8"
8+
+ LDFLAGS="${LDFLAGS} -march=armv7-a"
9+
fi
10+
else
11+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not Android" >&5
Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py
2-
--- a/Lib/ctypes/util.py
3-
+++ b/Lib/ctypes/util.py
4-
@@ -67,4 +67,11 @@
5-
return fname
6-
return None
1+
--- Python-3.11.4/Lib/ctypes/util.py 2023-06-07 03:30:27.000000000 +0530
2+
+++ Python-3.11.4.mod/Lib/ctypes/util.py 2023-07-08 11:44:53.453482872 +0530
3+
@@ -3,8 +3,15 @@
4+
import subprocess
5+
import sys
76

87
+# This patch overrides the find_library to look in the right places on
98
+# Android
@@ -12,4 +11,9 @@ diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py
1211
+ def find_library(name):
1312
+ return _find_lib(name)
1413
+
15-
elif os.name == "posix" and sys.platform == "darwin":
14+
# find_library(name) returns the pathname of a library, or None.
15+
-if os.name == "nt":
16+
+elif os.name == "nt":
17+
18+
def _get_build_version():
19+
"""Return the version of MSVC that was used to build Python.
Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
diff -Nru Python-3.8.2/Lib/site.py Python-3.8.2-new/Lib/site.py
2-
--- Python-3.8.2/Lib/site.py 2020-04-28 12:48:38.000000000 -0700
3-
+++ Python-3.8.2-new/Lib/site.py 2020-04-28 12:52:46.000000000 -0700
4-
@@ -487,7 +487,8 @@
1+
--- Python-3.11.4/Lib/site.py 2023-06-07 03:30:27.000000000 +0530
2+
+++ Python-3.11.4.mod/Lib/site.py 2023-07-08 11:31:15.088734501 +0530
3+
@@ -523,8 +523,7 @@
54
if key == 'include-system-site-packages':
65
system_site = value.lower()
76
elif key == 'home':
87
- sys._home = value
9-
+ # this is breaking pyconfig.h path detection with venv
10-
+ print('Ignoring "sys._home = value" override')
11-
8+
-
9+
+ print('Ignoring "sys._home = value" override', file=sys.stderr)
1210
sys.prefix = sys.exec_prefix = site_prefix
1311

12+
# Doing this here ensures venv takes precedence over user-site
Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
# DP: Build getbuildinfo.o with DATE/TIME values when defined
2-
3-
--- a/Makefile.pre.in
4-
+++ b/Makefile.pre.in
5-
@@ -785,6 +785,8 @@ Modules/getbuildinfo.o: $(PARSER_OBJS) \
1+
--- Python-3.11.4/Makefile.pre.in 2023-06-07 03:30:27.000000000 +0530
2+
+++ Python-3.11.4.mod/Makefile.pre.in 2023-07-08 11:38:12.788515487 +0530
3+
@@ -1238,6 +1238,8 @@
64
-DGITVERSION="\"`LC_ALL=C $(GITVERSION)`\"" \
75
-DGITTAG="\"`LC_ALL=C $(GITTAG)`\"" \
86
-DGITBRANCH="\"`LC_ALL=C $(GITBRANCH)`\"" \
9-
+ $(if $(BUILD_DATE),-DDATE='"$(BUILD_DATE)"') \
10-
+ $(if $(BUILD_TIME),-DTIME='"$(BUILD_TIME)"') \
7+
+ $(if $(BUILD_DATE),-DDATE='"$(BUILD_DATE)"') \
8+
+ $(if $(BUILD_TIME),-DTIME='"$(BUILD_TIME)"') \
119
-o $@ $(srcdir)/Modules/getbuildinfo.c
1210

13-
Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
11+
Modules/getpath.o: $(srcdir)/Modules/getpath.c Python/frozen_modules/getpath.h Makefile $(PYTHON_HEADERS)

0 commit comments

Comments
 (0)