Skip to content

Commit 9ed88eb

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into develop
2 parents e8a5c8e + a4a8b28 commit 9ed88eb

10 files changed

Lines changed: 108 additions & 53 deletions

File tree

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ bin/
66
*.pyc
77
**/__pycache__
88
*.egg-info/
9+
docker-data/

.github/workflows/push.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ jobs:
9898
- name: Maximize build space
9999
uses: easimon/maximize-build-space@v10
100100
with:
101-
root-reserve-mb: 30720
101+
root-reserve-mb: 4096
102102
swap-size-mb: 1024
103103
remove-dotnet: 'true'
104104
remove-android: 'true'
@@ -107,6 +107,13 @@ jobs:
107107
remove-docker-images: 'true'
108108
- name: Checkout python-for-android
109109
uses: actions/checkout@v5
110+
- name: Relocate Docker data directory
111+
run: |
112+
sudo systemctl stop docker
113+
sudo mkdir -p "${GITHUB_WORKSPACE}/docker-data"
114+
echo '{"data-root": "'${GITHUB_WORKSPACE}/docker-data'"}' | sudo tee /etc/docker/daemon.json
115+
sudo systemctl start docker
116+
docker info | grep "Docker Root Dir"
110117
- name: Build python-for-android docker image
111118
run: |
112119
docker build --tag=kivy/python-for-android .
@@ -224,7 +231,7 @@ jobs:
224231
- name: Maximize build space
225232
uses: easimon/maximize-build-space@v10
226233
with:
227-
root-reserve-mb: 30720
234+
root-reserve-mb: 4096
228235
swap-size-mb: 1024
229236
remove-dotnet: 'true'
230237
remove-android: 'true'
@@ -235,6 +242,13 @@ jobs:
235242
uses: actions/checkout@v5
236243
with:
237244
fetch-depth: 0
245+
- name: Relocate Docker data directory
246+
run: |
247+
sudo systemctl stop docker
248+
sudo mkdir -p "${GITHUB_WORKSPACE}/docker-data"
249+
echo '{"data-root": "'${GITHUB_WORKSPACE}/docker-data'"}' | sudo tee /etc/docker/daemon.json
250+
sudo systemctl start docker
251+
docker info | grep "Docker Root Dir"
238252
- name: Pull docker image
239253
run: |
240254
make docker/pull

ci/rebuild_updated_recipes.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
the list of recipes was huge and result was:
1919
[ERROR]: Didn't find any valid dependency graphs.
2020
[ERROR]: This means that some of your requirements pull in conflicting dependencies.
21-
- only rebuilds on sdl2 bootstrap
2221
"""
2322
import sh
2423
import os
@@ -57,14 +56,29 @@ def build(target_python, requirements, archs):
5756
android_sdk_home = os.environ['ANDROID_SDK_HOME']
5857
android_ndk_home = os.environ['ANDROID_NDK_HOME']
5958
requirements.add(target_python.name)
60-
requirements = ','.join(requirements)
61-
logger.info('requirements: {}'.format(requirements))
59+
requirements_str = ','.join(requirements)
60+
logger.info('requirements: {}'.format(requirements_str))
61+
62+
# Detect bootstrap based on requirements
63+
# SDL3 recipes conflict with SDL2, so we need the sdl3 bootstrap
64+
# when any SDL3-related recipe (sdl3, sdl3_image, sdl3_mixer, sdl3_ttf) is present
65+
bootstrap = None
66+
if any(r.startswith('sdl3') for r in requirements):
67+
bootstrap = 'sdl3'
68+
logger.info('Detected sdl3 recipe in requirements, using sdl3 bootstrap')
69+
6270
build_command = [
6371
'setup.py', 'apk',
6472
'--sdk-dir', android_sdk_home,
6573
'--ndk-dir', android_ndk_home,
66-
'--requirements', requirements
67-
] + [f"--arch={arch}" for arch in archs]
74+
'--requirements', requirements_str
75+
]
76+
77+
if bootstrap:
78+
build_command.extend(['--bootstrap', bootstrap])
79+
80+
build_command.extend([f"--arch={arch}" for arch in archs])
81+
6882
build_command_str = " ".join(build_command)
6983
logger.info(f"Build command: {build_command_str}")
7084

pythonforandroid/bootstraps/common/build/src/main/java/org/kivy/android/PythonUtil.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ protected static ArrayList<String> getLibraries(File libsDir) {
5959
addLibraryIfExists(libsList, name, libsDir);
6060
}
6161

62-
for (int v = 14; v >= 5; v--) {
63-
libsList.add("python3." + v + (v <= 7 ? "m" : ""));
62+
for (int v = 14; v >= 8; v--) {
63+
libsList.add("python3." + v);
6464
}
6565

6666
libsList.add("main");
@@ -85,7 +85,7 @@ public static void loadLibraries(File filesDir, File libsDir) {
8585
// load, and it has failed, give a more
8686
// general error
8787
Log.v(TAG, "Library loading error: " + e.getMessage());
88-
if (lib.startsWith("python3.14") && !foundPython) {
88+
if (lib.startsWith("python3.8") && !foundPython) {
8989
throw new RuntimeException("Could not load any libpythonXXX.so");
9090
} else if (lib.startsWith("python")) {
9191
continue;

pythonforandroid/recipes/kivy/__init__.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,25 @@
77
from pythonforandroid.toolchain import current_directory, shprint
88

99

10-
def is_kivy_affected_by_deadlock_issue(recipe=None, arch=None):
10+
def get_kivy_version(recipe, arch):
1111
with current_directory(join(recipe.get_build_dir(arch.arch), "kivy")):
12-
kivy_version = shprint(
12+
return shprint(
1313
sh.Command(sys.executable),
1414
"-c",
1515
"import _version; print(_version.__version__)",
1616
)
1717

18-
return packaging.version.parse(
19-
str(kivy_version)
20-
) < packaging.version.Version("2.2.0.dev0")
18+
19+
def is_kivy_affected_by_deadlock_issue(recipe=None, arch=None):
20+
return packaging.version.parse(
21+
str(get_kivy_version(recipe, arch))
22+
) < packaging.version.Version("2.2.0.dev0")
23+
24+
25+
def is_kivy_less_than_3(recipe=None, arch=None):
26+
return packaging.version.parse(
27+
str(get_kivy_version(recipe, arch))
28+
) < packaging.version.Version("3.0.0")
2129

2230

2331
class KivyRecipe(PyProjectRecipe):
@@ -34,7 +42,7 @@ class KivyRecipe(PyProjectRecipe):
3442
# WARNING: Remove this patch when a new Kivy version is released.
3543
patches = [
3644
("sdl-gl-swapwindow-nogil.patch", is_kivy_affected_by_deadlock_issue),
37-
"use_cython.patch",
45+
("use_cython.patch", is_kivy_less_than_3),
3846
"no-ast-str.patch"
3947
]
4048

@@ -59,6 +67,9 @@ def get_recipe_env(self, arch, **kwargs):
5967

6068
# NDKPLATFORM is our switch for detecting Android platform, so can't be None
6169
env['NDKPLATFORM'] = "NOTNONE"
70+
if not is_kivy_less_than_3(self, arch):
71+
env['KIVY_CROSS_PLATFORM'] = 'android'
72+
6273
if 'sdl2' in self.ctx.recipe_build_order:
6374
env['USE_SDL2'] = '1'
6475
env['KIVY_SPLIT_EXAMPLES'] = '1'

pythonforandroid/recipes/python3/__init__.py

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ class Python3Recipe(TargetPythonRecipe):
5555
'''
5656

5757
version = '3.14.2'
58-
_p_version = Version(version)
5958
url = 'https://github.com/python/cpython/archive/refs/tags/v{version}.tar.gz'
6059
name = 'python3'
6160

@@ -64,28 +63,6 @@ class Python3Recipe(TargetPythonRecipe):
6463
'patches/reproducible-buildinfo.diff',
6564
]
6665

67-
if _p_version.major == 3 and _p_version.minor == 7:
68-
patches += [
69-
'patches/py3.7.1_fix-ctypes-util-find-library.patch',
70-
'patches/py3.7.1_fix-zlib-version.patch',
71-
]
72-
73-
if 8 <= _p_version.minor <= 10:
74-
patches.append('patches/py3.8.1.patch')
75-
76-
if _p_version.minor >= 11:
77-
patches.append('patches/cpython-311-ctypes-find-library.patch')
78-
79-
if _p_version.minor >= 14:
80-
patches.append('patches/3.14_armv7l_fix.patch')
81-
patches.append('patches/3.14_fix_remote_debug.patch')
82-
83-
if shutil.which('lld') is not None:
84-
if _p_version.minor == 7:
85-
patches.append("patches/py3.7.1_fix_cortex_a8.patch")
86-
elif _p_version.minor >= 8:
87-
patches.append("patches/py3.8.1_fix_cortex_a8.patch")
88-
8966
depends = ['hostpython3', 'sqlite3', 'openssl', 'libffi']
9067
# those optional depends allow us to build python compression modules:
9168
# - _bz2.so
@@ -116,11 +93,6 @@ class Python3Recipe(TargetPythonRecipe):
11693
'ac_cv_header_bzlib_h=no',
11794
]
11895

119-
if _p_version.minor >= 11:
120-
configure_args.extend([
121-
'--with-build-python={python_host_bin}',
122-
])
123-
12496
'''The configure arguments needed to build the python recipe. Those are
12597
used in method :meth:`build_arch` (if not overwritten like python3's
12698
recipe does).
@@ -210,6 +182,34 @@ def link_version(self):
210182
flags=flags
211183
)
212184

185+
def apply_patches(self, arch, build_dir=None):
186+
187+
_p_version = Version(self.version)
188+
if _p_version.major == 3 and _p_version.minor == 7:
189+
self.patches += [
190+
'patches/py3.7.1_fix-ctypes-util-find-library.patch',
191+
'patches/py3.7.1_fix-zlib-version.patch',
192+
]
193+
194+
if 8 <= _p_version.minor <= 10:
195+
self.patches.append('patches/py3.8.1.patch')
196+
197+
if _p_version.minor >= 11:
198+
self.patches.append('patches/cpython-311-ctypes-find-library.patch')
199+
200+
if _p_version.minor >= 14:
201+
self.patches.append('patches/3.14_armv7l_fix.patch')
202+
self.patches.append('patches/3.14_fix_remote_debug.patch')
203+
204+
if shutil.which('lld') is not None:
205+
if _p_version.minor == 7:
206+
self.patches.append("patches/py3.7.1_fix_cortex_a8.patch")
207+
elif _p_version.minor >= 8:
208+
self.patches.append("patches/py3.8.1_fix_cortex_a8.patch")
209+
210+
self.patches = list(set(self.patches))
211+
super().apply_patches(arch, build_dir)
212+
213213
def include_root(self, arch_name):
214214
return join(self.get_build_dir(arch_name), 'Include')
215215

@@ -317,9 +317,15 @@ def add_flags(include_flags, link_dirs, link_libs):
317317
env['ZLIB_VERSION'] = line.replace('#define ZLIB_VERSION ', '')
318318
add_flags(' -I' + zlib_includes, ' -L' + zlib_lib_path, ' -lz')
319319

320-
if self._p_version.minor >= 13 and self.disable_gil:
320+
_p_version = Version(self.version)
321+
if _p_version.minor >= 11:
322+
self.configure_args.append('--with-build-python={python_host_bin}')
323+
324+
if _p_version.minor >= 13 and self.disable_gil:
321325
self.configure_args.append("--disable-gil")
322326

327+
self.configure_args = list(set(self.configure_args))
328+
323329
return env
324330

325331
def build_arch(self, arch):

pythonforandroid/recipes/sdl3/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77

88
class LibSDL3Recipe(BootstrapNDKRecipe):
9-
version = "3.2.18"
9+
version = "3.4.2"
1010
url = "https://github.com/libsdl-org/SDL/releases/download/release-{version}/SDL3-{version}.tar.gz"
11-
md5sum = "c7808ef624b74e2ac69cf531e78e0c6e"
11+
md5sum = "b488ea1ede947c06855588314effe905"
1212

1313
conflicts = ["sdl2"]
1414

pythonforandroid/recipes/sdl3_image/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77

88
class LibSDL3Image(BootstrapNDKRecipe):
9-
version = "3.2.4"
9+
version = "3.4.0"
1010
url = "https://github.com/libsdl-org/SDL_image/releases/download/release-{version}/SDL3_image-{version}.tar.gz"
1111
dir_name = "SDL3_image"
1212

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
1-
diff -Naur SDL2_image.orig/Android.mk SDL2_image/Android.mk
2-
--- SDL2_image.orig/Android.mk 2022-10-03 20:51:52.000000000 +0200
3-
+++ SDL2_image/Android.mk 2022-10-03 20:52:48.000000000 +0200
4-
@@ -32,7 +32,7 @@
1+
--- a/Android.mk
2+
+++ b/Android.mk
3+
@@ -33,8 +33,8 @@
54

65
# Enable this if you want to support loading WebP images
76
# The library path should be a relative path to this directory.
87
-SUPPORT_WEBP ?= false
8+
-SUPPORT_SAVE_WEBP ?= true
99
+SUPPORT_WEBP := true
10+
+SUPPORT_SAVE_WEBP := true
1011
WEBP_LIBRARY_PATH := external/libwebp
1112

1213

14+
@@ -160,7 +160,7 @@
15+
ifeq ($(SUPPORT_WEBP),true)
16+
LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(WEBP_LIBRARY_PATH)/src
17+
LOCAL_CFLAGS += -DLOAD_WEBP
18+
- LOCAL_STATIC_LIBRARIES += webpdemux
19+
+ LOCAL_STATIC_LIBRARIES += webpmux webpdemux
20+
LOCAL_STATIC_LIBRARIES += webp
21+
ifeq ($(SUPPORT_SAVE_WEBP),true)
22+
LOCAL_CFLAGS += -DSAVE_WEBP=1

pythonforandroid/recipes/sdl3_mixer/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
class LibSDL3Mixer(BootstrapNDKRecipe):
99
version = "72a73339731a12c1002f9caca64f1ab924938102"
10-
# url = "https://github.com/libsdl-org/SDL_ttf/releases/download/release-{version}/SDL3_ttf-{version}.tar.gz"
1110
url = "https://github.com/libsdl-org/SDL_mixer/archive/{version}.tar.gz"
1211
dir_name = "SDL3_mixer"
1312

0 commit comments

Comments
 (0)