Skip to content

Commit

Permalink
python: update to 3.11.5
Browse files Browse the repository at this point in the history
  • Loading branch information
T-Dynamos committed Sep 24, 2023
1 parent 4ebd3a8 commit 88844b7
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ protected static ArrayList<String> getLibraries(File libsDir) {
libsList.add("python3.8");
libsList.add("python3.9");
libsList.add("python3.10");
libsList.add("python3.11");
libsList.add("main");
return libsList;
}
Expand All @@ -74,7 +75,7 @@ public static void loadLibraries(File filesDir, File libsDir) {
// load, and it has failed, give a more
// general error
Log.v(TAG, "Library loading error: " + e.getMessage());
if (lib.startsWith("python3.10") && !foundPython) {
if (lib.startsWith("python3.11") && !foundPython) {
throw new RuntimeException("Could not load any libpythonXXX.so");
} else if (lib.startsWith("python")) {
continue;
Expand Down
2 changes: 1 addition & 1 deletion pythonforandroid/recipes/cython/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class CythonRecipe(CompiledComponentsPythonRecipe):

version = '0.29.28'
version = '0.29.36'
url = 'https://github.com/cython/cython/archive/{version}.tar.gz'
site_packages_name = 'cython'
depends = ['setuptools']
Expand Down
2 changes: 1 addition & 1 deletion pythonforandroid/recipes/hostpython3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class HostPython3Recipe(Recipe):
:class:`~pythonforandroid.python.HostPythonRecipe`
'''

version = '3.10.10'
version = '3.11.5'
name = 'hostpython3'

build_subdir = 'native-build'
Expand Down
28 changes: 23 additions & 5 deletions pythonforandroid/recipes/python3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class Python3Recipe(TargetPythonRecipe):
:class:`~pythonforandroid.python.GuestPythonRecipe`
'''

version = '3.10.10'
version = '3.11.5'
url = 'https://www.python.org/ftp/python/{version}/Python-{version}.tgz'
name = 'python3'

Expand All @@ -71,15 +71,16 @@ class Python3Recipe(TargetPythonRecipe):
# Python 3.8.1 & 3.9.X
('patches/py3.8.1.patch', version_starts_with("3.8")),
('patches/py3.8.1.patch', version_starts_with("3.9")),
('patches/py3.8.1.patch', version_starts_with("3.10"))
('patches/py3.8.1.patch', version_starts_with("3.10")),
]

if shutil.which('lld') is not None:
patches = patches + [
("patches/py3.7.1_fix_cortex_a8.patch", version_starts_with("3.7")),
("patches/py3.8.1_fix_cortex_a8.patch", version_starts_with("3.8")),
("patches/py3.8.1_fix_cortex_a8.patch", version_starts_with("3.9")),
("patches/py3.8.1_fix_cortex_a8.patch", version_starts_with("3.10"))
("patches/py3.8.1_fix_cortex_a8.patch", version_starts_with("3.10")),
("patches/py3.11.4_fix_cortex_a8.patch", version_starts_with("3.11"))
]

depends = ['hostpython3', 'sqlite3', 'openssl', 'libffi']
Expand All @@ -101,7 +102,12 @@ class Python3Recipe(TargetPythonRecipe):
'ac_cv_header_sys_eventfd_h=no',
'--prefix={prefix}',
'--exec-prefix={exec_prefix}',
'--enable-loadable-sqlite-extensions')
'--enable-loadable-sqlite-extensions'
)

if version_starts_with("3.11"):
configure_args += ('--with-build-python={python_host_bin}',)

'''The configure arguments needed to build the python recipe. Those are
used in method :meth:`build_arch` (if not overwritten like python3's
recipe does).
Expand Down Expand Up @@ -218,6 +224,13 @@ def get_recipe_env(self, arch=None, with_flags_in_cc=True):
else:
warning('lld not found, linking without it. '
'Consider installing lld if linker errors occur.')

if 'MAKEFLAGS' in env.keys() and version_starts_with("3.11"):
if "-j" in env['MAKEFLAGS']:
__ = env['MAKEFLAGS'].split(" ")
__.pop(__.index("-j") + 1) # -j 10, here pop 10
__.pop(__.index("-j")) # here pop '-j'
env["MAKEFLAGS"] = " ".join(__)

return env

Expand Down Expand Up @@ -323,12 +336,17 @@ def build_arch(self, arch):
*(' '.join(self.configure_args).format(
android_host=env['HOSTARCH'],
android_build=android_build,
python_host_bin=join(self.get_recipe(
'host' + self.name, self.ctx
).get_path_to_python(), "python3"),
prefix=sys_prefix,
exec_prefix=sys_exec_prefix)).split(' '),
_env=env)

# disable parallel build on 3.11 to fix:
# ld: error: unable to find library -lpython3.11
shprint(
sh.make, 'all', '-j', str(cpu_count()),
sh.make, 'all', '-j', (str(cpu_count()) if not version_starts_with("3.11") else "1"),
'INSTSONAME={lib_name}'.format(lib_name=self._libpython),
_env=env
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- Python-3.11.4/configure 2023-06-07 03:30:27.000000000 +0530
+++ Python-3.11.4.mod/configure 2023-07-08 11:51:11.031135937 +0530
@@ -6994,7 +6994,7 @@
printf "%s\n" "$_arm_arch" >&6; }
if test "$_arm_arch" = 7; then
BASECFLAGS="${BASECFLAGS} -mfloat-abi=softfp -mfpu=vfpv3-d16"
- LDFLAGS="${LDFLAGS} -march=armv7-a -Wl,--fix-cortex-a8"
+ LDFLAGS="${LDFLAGS} -march=armv7-a"
fi
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not Android" >&5

Large diffs are not rendered by default.

0 comments on commit 88844b7

Please sign in to comment.