Skip to content

Commit 296f99c

Browse files
committed
python: update to 3.11.4
1 parent 4ebd3a8 commit 296f99c

File tree

10 files changed

+75
-36
lines changed

10 files changed

+75
-36
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/cython/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
class CythonRecipe(CompiledComponentsPythonRecipe):
55

6-
version = '0.29.28'
6+
version = '0.29.36'
77
url = 'https://github.com/cython/cython/archive/{version}.tar.gz'
88
site_packages_name = 'cython'
99
depends = ['setuptools']

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: 17 additions & 5 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

@@ -71,15 +71,17 @@ class Python3Recipe(TargetPythonRecipe):
7171
# Python 3.8.1 & 3.9.X
7272
('patches/py3.8.1.patch', version_starts_with("3.8")),
7373
('patches/py3.8.1.patch', version_starts_with("3.9")),
74-
('patches/py3.8.1.patch', version_starts_with("3.10"))
74+
('patches/py3.8.1.patch', version_starts_with("3.10")),
75+
('patches/py3.11.4_disable_parallel_build.patch', version_starts_with("3.11"))
7576
]
7677

7778
if shutil.which('lld') is not None:
7879
patches = patches + [
7980
("patches/py3.7.1_fix_cortex_a8.patch", version_starts_with("3.7")),
8081
("patches/py3.8.1_fix_cortex_a8.patch", version_starts_with("3.8")),
8182
("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"))
83+
("patches/py3.8.1_fix_cortex_a8.patch", version_starts_with("3.10")),
84+
("patches/py3.11.4_fix_cortex_a8.patch", version_starts_with("3.11"))
8385
]
8486

8587
depends = ['hostpython3', 'sqlite3', 'openssl', 'libffi']
@@ -101,7 +103,12 @@ 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+
)
108+
109+
if version_starts_with("3.11"):
110+
configure_args += ('--with-build-python={python_host_bin}',)
111+
105112
'''The configure arguments needed to build the python recipe. Those are
106113
used in method :meth:`build_arch` (if not overwritten like python3's
107114
recipe does).
@@ -323,12 +330,17 @@ def build_arch(self, arch):
323330
*(' '.join(self.configure_args).format(
324331
android_host=env['HOSTARCH'],
325332
android_build=android_build,
333+
python_host_bin=join(self.get_recipe(
334+
'host' + self.name, self.ctx
335+
).get_path_to_python(), "python3"),
326336
prefix=sys_prefix,
327337
exec_prefix=sys_exec_prefix)).split(' '),
328338
_env=env)
329339

340+
# disable parallel build on 3.11 to fix:
341+
# ld: error: unable to find library -lpython3.11
330342
shprint(
331-
sh.make, 'all', '-j', str(cpu_count()),
343+
sh.make, 'all', '-j', (str(cpu_count()) if not version_starts_with("3.11") else "1"),
332344
'INSTSONAME={lib_name}'.format(lib_name=self._libpython),
333345
_env=env
334346
)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--- Python-3.11.4/setup.py 2023-06-07 03:30:27.000000000 +0530
2+
+++ Python-3.11.4.mod/setup.py 2023-07-09 15:04:57.209537129 +0530
3+
@@ -306,8 +306,10 @@
4+
self.failed_on_import = []
5+
self.missing = []
6+
self.disabled_configure = []
7+
- if '-j' in os.environ.get('MAKEFLAGS', ''):
8+
- self.parallel = True
9+
+
10+
+ # to fix linking errors on python3.11
11+
+ # if '-j' in os.environ.get('MAKEFLAGS', ''):
12+
+ # self.parallel = True
13+
14+
def add(self, ext):
15+
self.extensions.append(ext)
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)