2
2
import sh
3
3
import subprocess
4
4
5
- from multiprocessing import cpu_count
6
5
from os import environ , utime
7
6
from os .path import dirname , exists , join
8
7
from pathlib import Path
@@ -56,7 +55,7 @@ class Python3Recipe(TargetPythonRecipe):
56
55
:class:`~pythonforandroid.python.GuestPythonRecipe`
57
56
'''
58
57
59
- version = '3.10.10 '
58
+ version = '3.11.5 '
60
59
url = 'https://www.python.org/ftp/python/{version}/Python-{version}.tgz'
61
60
name = 'python3'
62
61
@@ -71,15 +70,17 @@ class Python3Recipe(TargetPythonRecipe):
71
70
# Python 3.8.1 & 3.9.X
72
71
('patches/py3.8.1.patch' , version_starts_with ("3.8" )),
73
72
('patches/py3.8.1.patch' , version_starts_with ("3.9" )),
74
- ('patches/py3.8.1.patch' , version_starts_with ("3.10" ))
73
+ ('patches/py3.8.1.patch' , version_starts_with ("3.10" )),
74
+ ('patches/cpython-311-ctypes-find-library.patch' , version_starts_with ("3.11" )),
75
75
]
76
76
77
77
if shutil .which ('lld' ) is not None :
78
- patches = patches + [
78
+ patches += [
79
79
("patches/py3.7.1_fix_cortex_a8.patch" , version_starts_with ("3.7" )),
80
80
("patches/py3.8.1_fix_cortex_a8.patch" , version_starts_with ("3.8" )),
81
81
("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.8.1_fix_cortex_a8.patch" , version_starts_with ("3.11" )),
83
84
]
84
85
85
86
depends = ['hostpython3' , 'sqlite3' , 'openssl' , 'libffi' ]
@@ -101,7 +102,12 @@ class Python3Recipe(TargetPythonRecipe):
101
102
'ac_cv_header_sys_eventfd_h=no' ,
102
103
'--prefix={prefix}' ,
103
104
'--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
+
105
111
'''The configure arguments needed to build the python recipe. Those are
106
112
used in method :meth:`build_arch` (if not overwritten like python3's
107
113
recipe does).
@@ -323,12 +329,19 @@ def build_arch(self, arch):
323
329
* (' ' .join (self .configure_args ).format (
324
330
android_host = env ['HOSTARCH' ],
325
331
android_build = android_build ,
332
+ python_host_bin = join (self .get_recipe (
333
+ 'host' + self .name , self .ctx
334
+ ).get_path_to_python (), "python3" ),
326
335
prefix = sys_prefix ,
327
336
exec_prefix = sys_exec_prefix )).split (' ' ),
328
337
_env = env )
329
338
339
+ # Python build does not seem to play well with make -j option from Python 3.11 and onwards
340
+ # Before losing some time, please check issue
341
+ # https://github.com/python/cpython/issues/101295 , as the root cause looks similar
330
342
shprint (
331
- sh .make , 'all' , '-j' , str (cpu_count ()),
343
+ sh .make ,
344
+ 'all' ,
332
345
'INSTSONAME={lib_name}' .format (lib_name = self ._libpython ),
333
346
_env = env
334
347
)
0 commit comments