diff --git a/pythonforandroid/bootstraps/common/build/src/main/java/org/kivy/android/PythonUtil.java b/pythonforandroid/bootstraps/common/build/src/main/java/org/kivy/android/PythonUtil.java index 5bc23bacf4..cc04d83f6b 100644 --- a/pythonforandroid/bootstraps/common/build/src/main/java/org/kivy/android/PythonUtil.java +++ b/pythonforandroid/bootstraps/common/build/src/main/java/org/kivy/android/PythonUtil.java @@ -55,6 +55,7 @@ protected static ArrayList getLibraries(File libsDir) { libsList.add("python3.8"); libsList.add("python3.9"); libsList.add("python3.10"); + libsList.add("python3.11"); libsList.add("main"); return libsList; } @@ -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; diff --git a/pythonforandroid/recipes/hostpython3/__init__.py b/pythonforandroid/recipes/hostpython3/__init__.py index ee53b6ef09..6fcb590339 100644 --- a/pythonforandroid/recipes/hostpython3/__init__.py +++ b/pythonforandroid/recipes/hostpython3/__init__.py @@ -35,7 +35,7 @@ class HostPython3Recipe(Recipe): :class:`~pythonforandroid.python.HostPythonRecipe` ''' - version = '3.10.10' + version = '3.11.4' name = 'hostpython3' build_subdir = 'native-build' diff --git a/pythonforandroid/recipes/hostpython3/patches/pyconfig_detection.patch b/pythonforandroid/recipes/hostpython3/patches/pyconfig_detection.patch index 7f78b664e1..e77b12f68c 100644 --- a/pythonforandroid/recipes/hostpython3/patches/pyconfig_detection.patch +++ b/pythonforandroid/recipes/hostpython3/patches/pyconfig_detection.patch @@ -1,13 +1,12 @@ -diff -Nru Python-3.8.2/Lib/site.py Python-3.8.2-new/Lib/site.py ---- Python-3.8.2/Lib/site.py 2020-04-28 12:48:38.000000000 -0700 -+++ Python-3.8.2-new/Lib/site.py 2020-04-28 12:52:46.000000000 -0700 -@@ -487,7 +487,8 @@ +--- Python-3.11.4/Lib/site.py 2023-06-07 03:30:27.000000000 +0530 ++++ Python-3.11.4.mod/Lib/site.py 2023-07-08 11:31:15.088734501 +0530 +@@ -523,8 +523,7 @@ if key == 'include-system-site-packages': system_site = value.lower() elif key == 'home': - sys._home = value -+ # this is breaking pyconfig.h path detection with venv +- + print('Ignoring "sys._home = value" override', file=sys.stderr) - sys.prefix = sys.exec_prefix = site_prefix + # Doing this here ensures venv takes precedence over user-site diff --git a/pythonforandroid/recipes/python3/__init__.py b/pythonforandroid/recipes/python3/__init__.py index 387922718e..558d408204 100644 --- a/pythonforandroid/recipes/python3/__init__.py +++ b/pythonforandroid/recipes/python3/__init__.py @@ -56,7 +56,7 @@ class Python3Recipe(TargetPythonRecipe): :class:`~pythonforandroid.python.GuestPythonRecipe` ''' - version = '3.10.10' + version = '3.11.4' url = 'https://www.python.org/ftp/python/{version}/Python-{version}.tgz' name = 'python3' @@ -79,7 +79,8 @@ class Python3Recipe(TargetPythonRecipe): ("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'] @@ -92,6 +93,7 @@ class Python3Recipe(TargetPythonRecipe): configure_args = ( '--host={android_host}', '--build={android_build}', + '--with-build-python={python_host_bin}', '--enable-shared', '--enable-ipv6', 'ac_cv_file__dev_ptmx=yes', @@ -101,7 +103,8 @@ class Python3Recipe(TargetPythonRecipe): 'ac_cv_header_sys_eventfd_h=no', '--prefix={prefix}', '--exec-prefix={exec_prefix}', - '--enable-loadable-sqlite-extensions') + '--enable-loadable-sqlite-extensions' + ) '''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). @@ -323,6 +326,9 @@ 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(), "bin", "python3"), prefix=sys_prefix, exec_prefix=sys_exec_prefix)).split(' '), _env=env) diff --git a/pythonforandroid/recipes/python3/patches/py3.11.4_fix_cortex_a8.patch b/pythonforandroid/recipes/python3/patches/py3.11.4_fix_cortex_a8.patch new file mode 100644 index 0000000000..e799135915 --- /dev/null +++ b/pythonforandroid/recipes/python3/patches/py3.11.4_fix_cortex_a8.patch @@ -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 diff --git a/pythonforandroid/recipes/python3/patches/py3.7.1_fix-ctypes-util-find-library.patch b/pythonforandroid/recipes/python3/patches/py3.7.1_fix-ctypes-util-find-library.patch index 494270d2c7..5d22dfe4b1 100644 --- a/pythonforandroid/recipes/python3/patches/py3.7.1_fix-ctypes-util-find-library.patch +++ b/pythonforandroid/recipes/python3/patches/py3.7.1_fix-ctypes-util-find-library.patch @@ -1,9 +1,8 @@ -diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py ---- a/Lib/ctypes/util.py -+++ b/Lib/ctypes/util.py -@@ -67,4 +67,11 @@ - return fname - return None +--- Python-3.11.4/Lib/ctypes/util.py 2023-06-07 03:30:27.000000000 +0530 ++++ Python-3.11.4.mod/Lib/ctypes/util.py 2023-07-08 11:44:53.453482872 +0530 +@@ -3,8 +3,15 @@ + import subprocess + import sys +# This patch overrides the find_library to look in the right places on +# Android @@ -12,4 +11,9 @@ diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py + def find_library(name): + return _find_lib(name) + - elif os.name == "posix" and sys.platform == "darwin": + # find_library(name) returns the pathname of a library, or None. +-if os.name == "nt": ++elif os.name == "nt": + + def _get_build_version(): + """Return the version of MSVC that was used to build Python. diff --git a/pythonforandroid/recipes/python3/patches/pyconfig_detection.patch b/pythonforandroid/recipes/python3/patches/pyconfig_detection.patch index 087ab586ad..e77b12f68c 100644 --- a/pythonforandroid/recipes/python3/patches/pyconfig_detection.patch +++ b/pythonforandroid/recipes/python3/patches/pyconfig_detection.patch @@ -1,13 +1,12 @@ -diff -Nru Python-3.8.2/Lib/site.py Python-3.8.2-new/Lib/site.py ---- Python-3.8.2/Lib/site.py 2020-04-28 12:48:38.000000000 -0700 -+++ Python-3.8.2-new/Lib/site.py 2020-04-28 12:52:46.000000000 -0700 -@@ -487,7 +487,8 @@ +--- Python-3.11.4/Lib/site.py 2023-06-07 03:30:27.000000000 +0530 ++++ Python-3.11.4.mod/Lib/site.py 2023-07-08 11:31:15.088734501 +0530 +@@ -523,8 +523,7 @@ if key == 'include-system-site-packages': system_site = value.lower() elif key == 'home': - sys._home = value -+ # this is breaking pyconfig.h path detection with venv -+ print('Ignoring "sys._home = value" override') - +- ++ print('Ignoring "sys._home = value" override', file=sys.stderr) sys.prefix = sys.exec_prefix = site_prefix + # Doing this here ensures venv takes precedence over user-site diff --git a/pythonforandroid/recipes/python3/patches/reproducible-buildinfo.diff b/pythonforandroid/recipes/python3/patches/reproducible-buildinfo.diff index 807d180a68..9c854a8f63 100644 --- a/pythonforandroid/recipes/python3/patches/reproducible-buildinfo.diff +++ b/pythonforandroid/recipes/python3/patches/reproducible-buildinfo.diff @@ -1,13 +1,11 @@ -# DP: Build getbuildinfo.o with DATE/TIME values when defined - ---- a/Makefile.pre.in -+++ b/Makefile.pre.in -@@ -785,6 +785,8 @@ Modules/getbuildinfo.o: $(PARSER_OBJS) \ +--- Python-3.11.4/Makefile.pre.in 2023-06-07 03:30:27.000000000 +0530 ++++ Python-3.11.4.mod/Makefile.pre.in 2023-07-08 11:38:12.788515487 +0530 +@@ -1238,6 +1238,8 @@ -DGITVERSION="\"`LC_ALL=C $(GITVERSION)`\"" \ -DGITTAG="\"`LC_ALL=C $(GITTAG)`\"" \ -DGITBRANCH="\"`LC_ALL=C $(GITBRANCH)`\"" \ -+ $(if $(BUILD_DATE),-DDATE='"$(BUILD_DATE)"') \ -+ $(if $(BUILD_TIME),-DTIME='"$(BUILD_TIME)"') \ ++ $(if $(BUILD_DATE),-DDATE='"$(BUILD_DATE)"') \ ++ $(if $(BUILD_TIME),-DTIME='"$(BUILD_TIME)"') \ -o $@ $(srcdir)/Modules/getbuildinfo.c - Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile + Modules/getpath.o: $(srcdir)/Modules/getpath.c Python/frozen_modules/getpath.h Makefile $(PYTHON_HEADERS)