Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/source/buildoptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Python versions

python-for-android supports using non-end-of-life Python 3 versions. To explicitly
select a Python version in your requirements, use e.g.
``--requirements=python3==3.14.2,hostpython3==3.14.2``.
``--requirements=python3==3.15.2,hostpython3==3.15.2``.

The last python-for-android version supporting Python2 was `v2019.10.06 <https://github.com/kivy/python-for-android/archive/v2019.10.06.zip>`__

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ protected static ArrayList<String> getLibraries(File libsDir) {
addLibraryIfExists(libsList, name, libsDir);
}

for (int v = 14; v >= 8; v--) {
for (int v = 15; v >= 8; v--) {
libsList.add("python3." + v);
}

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 @@ -32,7 +32,7 @@ class HostPython3Recipe(Recipe):
:class:`~pythonforandroid.python.HostPythonRecipe`
"""

version = "3.14.2"
version = "3.15.2"

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
Expand Down
6 changes: 4 additions & 2 deletions pythonforandroid/recipes/python3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class Python3Recipe(TargetPythonRecipe):
:class:`~pythonforandroid.python.GuestPythonRecipe`
'''

version = '3.14.2'
version = '3.15.2'
url = 'https://github.com/python/cpython/archive/refs/tags/v{version}.tar.gz'
name = 'python3'

Expand Down Expand Up @@ -207,8 +207,10 @@ def apply_patches(self, arch, build_dir=None):
if _p_version.minor >= 11:
self.patches.append('patches/cpython-311-ctypes-find-library.patch')

if _p_version.minor >= 14:
if Version('3.14') <= _p_version < Version('3.14.4'):
self.patches.append('patches/3.14_armv7l_fix.patch')

if _p_version.minor == 14:
self.patches.append('patches/3.14_fix_remote_debug.patch')

if shutil.which('lld') is not None:
Expand Down
36 changes: 36 additions & 0 deletions tests/recipes/test_python3.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,39 @@ def test_build_arch_wrong_ndk_api(self):
# restore recipe's ctx or we could get failures with other test,
# since we share `self.recipe with all the tests of the class
self.recipe.ctx.ndk_api = self.ctx.ndk_api

@mock.patch("pythonforandroid.recipe.Recipe.apply_patches")
def test_apply_patches_version_conditionals(self, mock_super_apply_patches):
orig_version = self.recipe._version
orig_patches = list(self.recipe.patches)
try:
# Python 3.14.2: should include 3.14_armv7l_fix.patch and 3.14_fix_remote_debug.patch
self.recipe._version = '3.14.2'
self.recipe.patches = list(orig_patches)
self.recipe.apply_patches(self.arch)
self.assertIn('patches/3.14_armv7l_fix.patch', self.recipe.patches)
self.assertIn('patches/3.14_fix_remote_debug.patch', self.recipe.patches)

# Python 3.14.4: should NOT include 3.14_armv7l_fix.patch, but should include 3.14_fix_remote_debug.patch
self.recipe._version = '3.14.4'
self.recipe.patches = list(orig_patches)
self.recipe.apply_patches(self.arch)
self.assertNotIn('patches/3.14_armv7l_fix.patch', self.recipe.patches)
self.assertIn('patches/3.14_fix_remote_debug.patch', self.recipe.patches)

# Python 3.14.10: should NOT include 3.14_armv7l_fix.patch, but should include 3.14_fix_remote_debug.patch
self.recipe._version = '3.14.10'
self.recipe.patches = list(orig_patches)
self.recipe.apply_patches(self.arch)
self.assertNotIn('patches/3.14_armv7l_fix.patch', self.recipe.patches)
self.assertIn('patches/3.14_fix_remote_debug.patch', self.recipe.patches)

# Python 3.15.2: should NOT include 3.14_armv7l_fix.patch nor 3.14_fix_remote_debug.patch
self.recipe._version = '3.15.2'
self.recipe.patches = list(orig_patches)
self.recipe.apply_patches(self.arch)
self.assertNotIn('patches/3.14_armv7l_fix.patch', self.recipe.patches)
self.assertNotIn('patches/3.14_fix_remote_debug.patch', self.recipe.patches)
finally:
self.recipe._version = orig_version
self.recipe.patches = orig_patches
Loading