@@ -56,7 +56,7 @@ class Python3Recipe(TargetPythonRecipe):
5656 :class:`~pythonforandroid.python.GuestPythonRecipe`
5757 '''
5858
59- version = '3.10.10 '
59+ version = '3.11.5 '
6060 url = 'https://www.python.org/ftp/python/{version}/Python-{version}.tgz'
6161 name = 'python3'
6262
@@ -71,15 +71,16 @@ 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" )),
7575 ]
7676
7777 if shutil .which ('lld' ) is not None :
7878 patches = patches + [
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' ]
@@ -101,7 +102,12 @@ class Python3Recipe(TargetPythonRecipe):
101102 'ac_cv_header_sys_eventfd_h=no' ,
102103 '--prefix={prefix}' ,
103104 '--exec-prefix={exec_prefix}' ,
104- '--enable-loadable-sqlite-extensions' )
105+ '--enable-loadable-sqlite-extensions'
106+ )
107+
108+ if version_starts_with ("3.11" ):
109+ configure_args += ('--with-build-python={python_host_bin}' ,)
110+
105111 '''The configure arguments needed to build the python recipe. Those are
106112 used in method :meth:`build_arch` (if not overwritten like python3's
107113 recipe does).
@@ -219,6 +225,13 @@ def get_recipe_env(self, arch=None, with_flags_in_cc=True):
219225 warning ('lld not found, linking without it. '
220226 'Consider installing lld if linker errors occur.' )
221227
228+ if 'MAKEFLAGS' in env .keys () and version_starts_with ("3.11" ):
229+ if "-j" in env ['MAKEFLAGS' ]:
230+ __ = env ['MAKEFLAGS' ].split (" " )
231+ __ .pop (__ .index ("-j" ) + 1 ) # -j 10, here pop 10
232+ __ .pop (__ .index ("-j" )) # here pop '-j'
233+ env ["MAKEFLAGS" ] = " " .join (__ )
234+
222235 return env
223236
224237 def set_libs_flags (self , env , arch ):
@@ -323,12 +336,17 @@ def build_arch(self, arch):
323336 * (' ' .join (self .configure_args ).format (
324337 android_host = env ['HOSTARCH' ],
325338 android_build = android_build ,
339+ python_host_bin = join (self .get_recipe (
340+ 'host' + self .name , self .ctx
341+ ).get_path_to_python (), "python3" ),
326342 prefix = sys_prefix ,
327343 exec_prefix = sys_exec_prefix )).split (' ' ),
328344 _env = env )
329345
346+ # disable parallel build on 3.11 to fix:
347+ # ld: error: unable to find library -lpython3.11
330348 shprint (
331- sh .make , 'all' , '-j' , str (cpu_count ()),
349+ sh .make , 'all' , '-j' , ( str (cpu_count ()) if not version_starts_with ( "3.11" ) else "1" ),
332350 'INSTSONAME={lib_name}' .format (lib_name = self ._libpython ),
333351 _env = env
334352 )
0 commit comments