From 6559b2af1dad52ae8438de21c291a1494969285c Mon Sep 17 00:00:00 2001 From: Ansh Dadwal Date: Wed, 15 Oct 2025 22:01:19 +0530 Subject: [PATCH 1/2] `python`: update to `3.14.0` --- .../src/main/java/org/kivy/android/PythonUtil.java | 2 +- pythonforandroid/recipes/hostpython3/__init__.py | 2 +- pythonforandroid/recipes/python3/__init__.py | 13 ++++--------- pythonforandroid/recipes/six/__init__.py | 10 ---------- 4 files changed, 6 insertions(+), 21 deletions(-) delete mode 100644 pythonforandroid/recipes/six/__init__.py 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 065f43c3bd..9e19a6327d 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 @@ -51,7 +51,7 @@ protected static ArrayList getLibraries(File libsDir) { addLibraryIfExists(libsList, name, libsDir); } - for (int v = 5; v <= 14; v++) { + for (int v = 14; v >= 5; v--) { libsList.add("python3." + v + (v <= 7 ? "m" : "")); } diff --git a/pythonforandroid/recipes/hostpython3/__init__.py b/pythonforandroid/recipes/hostpython3/__init__.py index 094660fada..afc4df4955 100644 --- a/pythonforandroid/recipes/hostpython3/__init__.py +++ b/pythonforandroid/recipes/hostpython3/__init__.py @@ -36,7 +36,7 @@ class HostPython3Recipe(Recipe): :class:`~pythonforandroid.python.HostPythonRecipe` ''' - version = '3.11.13' + version = '3.14.0' url = 'https://github.com/python/cpython/archive/refs/tags/v{version}.tar.gz' '''The default url to download our host python recipe. This url will diff --git a/pythonforandroid/recipes/python3/__init__.py b/pythonforandroid/recipes/python3/__init__.py index 81aee7c66e..4c234ce8f4 100644 --- a/pythonforandroid/recipes/python3/__init__.py +++ b/pythonforandroid/recipes/python3/__init__.py @@ -54,7 +54,7 @@ class Python3Recipe(TargetPythonRecipe): :class:`~pythonforandroid.python.GuestPythonRecipe` ''' - version = '3.11.13' + version = '3.14.0' _p_version = Version(version) url = 'https://github.com/python/cpython/archive/refs/tags/v{version}.tar.gz' name = 'python3' @@ -389,17 +389,12 @@ def create_python_bundle(self, dirn, arch): place. """ # Todo: find a better way to find the build libs folder - modules_build_dir = join( + modules_build_dir = glob.glob(join( self.get_build_dir(arch.arch), 'android-build', 'build', - 'lib.{}{}-{}-{}'.format( - # android is now supported platform - "android" if self._p_version.minor >= 13 else "linux", - '2' if self.version[0] == '2' else '', - arch.command_prefix.split('-')[0], - self.major_minor_version_string - )) + 'lib.*' + ))[0] # Compile to *.pyc the python modules self.compile_python_files(modules_build_dir) diff --git a/pythonforandroid/recipes/six/__init__.py b/pythonforandroid/recipes/six/__init__.py deleted file mode 100644 index 3be8ce7578..0000000000 --- a/pythonforandroid/recipes/six/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ -from pythonforandroid.recipe import PythonRecipe - - -class SixRecipe(PythonRecipe): - version = '1.15.0' - url = 'https://pypi.python.org/packages/source/s/six/six-{version}.tar.gz' - depends = ['setuptools'] - - -recipe = SixRecipe() From b7acb1a2306d2bc2014274f400bbdada84d6df2d Mon Sep 17 00:00:00 2001 From: Zachary Spector Date: Mon, 20 Oct 2025 08:21:04 +1300 Subject: [PATCH 2/2] Patch out the reference to `ast.Str` in `kivy.lang.parser` It broke Python 3.14, and I don't think Kivy even supports Python 3.6 anymore --- .../main/java/org/kivy/android/PythonUtil.java | 2 +- pythonforandroid/recipes/hostpython3/__init__.py | 2 +- pythonforandroid/recipes/kivy/__init__.py | 6 +++++- pythonforandroid/recipes/kivy/no-ast-str.patch | 16 ++++++++++++++++ pythonforandroid/recipes/python3/__init__.py | 13 +++++++++---- pythonforandroid/recipes/six/__init__.py | 10 ++++++++++ 6 files changed, 42 insertions(+), 7 deletions(-) create mode 100644 pythonforandroid/recipes/kivy/no-ast-str.patch create mode 100644 pythonforandroid/recipes/six/__init__.py 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 9e19a6327d..065f43c3bd 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 @@ -51,7 +51,7 @@ protected static ArrayList getLibraries(File libsDir) { addLibraryIfExists(libsList, name, libsDir); } - for (int v = 14; v >= 5; v--) { + for (int v = 5; v <= 14; v++) { libsList.add("python3." + v + (v <= 7 ? "m" : "")); } diff --git a/pythonforandroid/recipes/hostpython3/__init__.py b/pythonforandroid/recipes/hostpython3/__init__.py index afc4df4955..094660fada 100644 --- a/pythonforandroid/recipes/hostpython3/__init__.py +++ b/pythonforandroid/recipes/hostpython3/__init__.py @@ -36,7 +36,7 @@ class HostPython3Recipe(Recipe): :class:`~pythonforandroid.python.HostPythonRecipe` ''' - version = '3.14.0' + version = '3.11.13' url = 'https://github.com/python/cpython/archive/refs/tags/v{version}.tar.gz' '''The default url to download our host python recipe. This url will diff --git a/pythonforandroid/recipes/kivy/__init__.py b/pythonforandroid/recipes/kivy/__init__.py index d9ca543f36..c545bbc4c1 100644 --- a/pythonforandroid/recipes/kivy/__init__.py +++ b/pythonforandroid/recipes/kivy/__init__.py @@ -32,7 +32,11 @@ class KivyRecipe(PyProjectRecipe): # sdl-gl-swapwindow-nogil.patch is needed to avoid a deadlock. # See: https://github.com/kivy/kivy/pull/8025 # WARNING: Remove this patch when a new Kivy version is released. - patches = [("sdl-gl-swapwindow-nogil.patch", is_kivy_affected_by_deadlock_issue), "use_cython.patch"] + patches = [ + ("sdl-gl-swapwindow-nogil.patch", is_kivy_affected_by_deadlock_issue), + "use_cython.patch", + "no-ast-str.patch" + ] @property def need_stl_shared(self): diff --git a/pythonforandroid/recipes/kivy/no-ast-str.patch b/pythonforandroid/recipes/kivy/no-ast-str.patch new file mode 100644 index 0000000000..09ac0efa74 --- /dev/null +++ b/pythonforandroid/recipes/kivy/no-ast-str.patch @@ -0,0 +1,16 @@ +diff -ur kivy-2.3.1b/kivy/lang/parser.py kivy-2.3.1/kivy/lang/parser.py +--- kivy-2.3.1b/kivy/lang/parser.py 2025-10-19 13:04:51.542798827 +1300 ++++ kivy-2.3.1/kivy/lang/parser.py 2025-10-19 13:05:16.007104601 +1300 +@@ -230,11 +230,7 @@ + + if isinstance(node, (ast.JoinedStr, ast.BoolOp)): + for n in node.values: +- if isinstance(n, ast.Str): +- # NOTE: required for python3.6 +- yield from cls.get_names_from_expression(n.s) +- else: +- yield from cls.get_names_from_expression(n.value) ++ yield from cls.get_names_from_expression(n.value) + + if isinstance(node, ast.BinOp): + yield from cls.get_names_from_expression(node.right) diff --git a/pythonforandroid/recipes/python3/__init__.py b/pythonforandroid/recipes/python3/__init__.py index 4c234ce8f4..81aee7c66e 100644 --- a/pythonforandroid/recipes/python3/__init__.py +++ b/pythonforandroid/recipes/python3/__init__.py @@ -54,7 +54,7 @@ class Python3Recipe(TargetPythonRecipe): :class:`~pythonforandroid.python.GuestPythonRecipe` ''' - version = '3.14.0' + version = '3.11.13' _p_version = Version(version) url = 'https://github.com/python/cpython/archive/refs/tags/v{version}.tar.gz' name = 'python3' @@ -389,12 +389,17 @@ def create_python_bundle(self, dirn, arch): place. """ # Todo: find a better way to find the build libs folder - modules_build_dir = glob.glob(join( + modules_build_dir = join( self.get_build_dir(arch.arch), 'android-build', 'build', - 'lib.*' - ))[0] + 'lib.{}{}-{}-{}'.format( + # android is now supported platform + "android" if self._p_version.minor >= 13 else "linux", + '2' if self.version[0] == '2' else '', + arch.command_prefix.split('-')[0], + self.major_minor_version_string + )) # Compile to *.pyc the python modules self.compile_python_files(modules_build_dir) diff --git a/pythonforandroid/recipes/six/__init__.py b/pythonforandroid/recipes/six/__init__.py new file mode 100644 index 0000000000..3be8ce7578 --- /dev/null +++ b/pythonforandroid/recipes/six/__init__.py @@ -0,0 +1,10 @@ +from pythonforandroid.recipe import PythonRecipe + + +class SixRecipe(PythonRecipe): + version = '1.15.0' + url = 'https://pypi.python.org/packages/source/s/six/six-{version}.tar.gz' + depends = ['setuptools'] + + +recipe = SixRecipe()