Skip to content

Commit cdb06f8

Browse files
authored
Merge branch 'develop' into patch-1
2 parents 841d2ab + d129d08 commit cdb06f8

File tree

120 files changed

+1601
-752
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+1601
-752
lines changed

.github/workflows/push.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ env:
88
AAR_ARTIFACT_FILENAME: bdist_unit_tests_app-release-1.1.aar
99
PYTHONFORANDROID_PREREQUISITES_INSTALL_INTERACTIVE: 0
1010

11+
concurrency:
12+
group: build-${{ github.ref }}
13+
cancel-in-progress: true
14+
1115
jobs:
1216

1317
flake8:
@@ -100,7 +104,7 @@ jobs:
100104
if [ -f dist/${{ env.AAB_ARTIFACT_FILENAME }} ]; then mv dist/${{ env.AAB_ARTIFACT_FILENAME }} dist/${{ matrix.runs_on }}-${{ matrix.bootstrap.name }}-${{ env.AAB_ARTIFACT_FILENAME }}; fi
101105
if [ -f dist/${{ env.AAR_ARTIFACT_FILENAME }} ]; then mv dist/${{ env.AAR_ARTIFACT_FILENAME }} dist/${{ matrix.runs_on }}-${{ matrix.bootstrap.name }}-${{ env.AAR_ARTIFACT_FILENAME }}; fi
102106
- name: Upload artifacts
103-
uses: actions/upload-artifact@v3
107+
uses: actions/upload-artifact@v4
104108
with:
105109
name: ${{ matrix.runs_on }}-${{ matrix.bootstrap.name }}-artifacts
106110
path: dist
@@ -155,7 +159,7 @@ jobs:
155159
if [ -f dist/${{ env.APK_ARTIFACT_FILENAME }} ]; then mv dist/${{ env.APK_ARTIFACT_FILENAME }} dist/${{ matrix.runs_on }}-${{ matrix.bootstrap.name }}-${{ env.APK_ARTIFACT_FILENAME }}; fi
156160
if [ -f dist/${{ env.AAB_ARTIFACT_FILENAME }} ]; then mv dist/${{ env.AAB_ARTIFACT_FILENAME }} dist/${{ matrix.runs_on }}-${{ matrix.bootstrap.name }}-${{ env.AAB_ARTIFACT_FILENAME }}; fi
157161
- name: Upload artifacts
158-
uses: actions/upload-artifact@v3
162+
uses: actions/upload-artifact@v4
159163
with:
160164
name: ${{ matrix.runs_on }}-${{ matrix.bootstrap.name }}-artifacts
161165
path: dist
@@ -182,7 +186,7 @@ jobs:
182186
sudo swapoff -a
183187
sudo rm -f /swapfile
184188
sudo apt -y clean
185-
docker rmi $(docker image ls -aq)
189+
docker images -q | xargs -r docker rmi
186190
df -h
187191
- name: Pull docker image
188192
run: |

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2010-2023 Kivy Team and other contributors
3+
Copyright (c) 2010-2025 Kivy Team and other contributors
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

ci/constants.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ class TargetPython(Enum):
3333
'twisted',
3434
# genericndkbuild is incompatible with sdl2 (which is build by default when targeting sdl2 bootstrap)
3535
'genericndkbuild',
36-
# libmysqlclient gives a linker failure (See issue #2808)
37-
'libmysqlclient',
3836
# boost gives errors (requires numpy? syntax error in .jam?)
3937
'boost',
4038
# libtorrent gives errors (requires boost. Also, see issue #2809, to start with)

ci/makefiles/android.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Downloads and installs the Android SDK depending on supplied platform: darwin or linux
22

33
# Those android NDK/SDK variables can be override when running the file
4-
ANDROID_NDK_VERSION ?= 25b
4+
ANDROID_NDK_VERSION ?= 28c
55
ANDROID_NDK_VERSION_LEGACY ?= 21e
66
ANDROID_SDK_TOOLS_VERSION ?= 6514223
77
ANDROID_SDK_BUILD_TOOLS_VERSION ?= 29.0.3
88
ANDROID_HOME ?= $(HOME)/.android
9-
ANDROID_API_LEVEL ?= 27
9+
ANDROID_API_LEVEL ?= 36
1010

1111
# per OS dictionary-like
1212
UNAME_S := $(shell uname -s)

doc/source/quickstart.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ You can also test the master branch from Github using::
5757
pip install git+https://github.com/kivy/python-for-android.git
5858

5959
Installing Prerequisites
60-
~~~~~~~~~~~~~~~~~~~~~~~
60+
~~~~~~~~~~~~~~~~~~~~~~~~
6161

6262
p4a requires a few dependencies to be installed on your system to work
6363
properly. While we're working on a way to automate pre-requisites checks,
@@ -119,7 +119,7 @@ named ``tools``, and you will need to run extra commands to install
119119
the SDK packages needed.
120120

121121
For Android NDK, note that modern releases will only work on a 64-bit
122-
operating system. **The minimal, and recommended, NDK version to use is r25b:**
122+
operating system. **The minimal, and recommended, NDK version to use is r28c:**
123123

124124
- `Go to ndk downloads page <https://developer.android.com/ndk/downloads/>`_
125125
- Windows users should create a virtual machine with an GNU Linux os
@@ -154,7 +154,7 @@ variables necessary for building on android::
154154
# Adjust the paths!
155155
export ANDROIDSDK="$HOME/Documents/android-sdk-27"
156156
export ANDROIDNDK="$HOME/Documents/android-ndk-r23b"
157-
export ANDROIDAPI="27" # Target API version of your application
157+
export ANDROIDAPI="36" # Target API version of your application
158158
export NDKAPI="21" # Minimum supported API version of your application
159159
export ANDROIDNDKVER="r10e" # Version of the NDK you installed
160160

doc/source/recipes.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,29 @@ omitted if the source is somehow loaded from elsewhere.
5454
You must include ``recipe = YourRecipe()``. This variable is accessed
5555
when the recipe is imported.
5656

57+
Specifying the URL
58+
------------------
59+
5760
.. note:: The url includes the ``{version}`` tag. You should only
5861
access the url with the ``versioned_url`` property, which
5962
replaces this with the version attribute.
6063

64+
.. note:: you may need to specify additional headers to allow python-for-android
65+
to download the archive. Specify your additional headers by setting the
66+
download_headers property.
67+
68+
For example, when downloading from a private github repository, you can specify the following:
69+
70+
(For the download_headers property in your recipe)
71+
```
72+
[('Authorization', 'token <your personal access token>'), ('Accept', 'application/vnd.github+json')]
73+
```
74+
75+
(For the DOWNLOAD_HEADERS_my-package-name environment variable - specify as a JSON formatted set of values)
76+
.. code-block:: bash
77+
78+
[["Authorization","token <your personal access token>"],["Accept", "application/vnd.github+json"]]
79+
6180
The actual build process takes place via three core methods::
6281

6382
def prebuild_arch(self, arch):

doc/source/testing_pull_requests.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ Using python-for-android commands directly from the pull request files
118118
--requirements=sdl2,pyjnius,kivy,python3,pycryptodome \
119119
--ndk-dir=/media/DEVEL/Android/android-ndk-r20 \
120120
--sdk-dir=/media/DEVEL/Android/android-sdk-linux \
121-
--android-api=27 \
121+
--android-api=36 \
122122
--arch=arm64-v8a \
123123
--permission=VIBRATE \
124124
--debug
@@ -175,7 +175,7 @@ Installing python-for-android using the github's branch of the pull request
175175
python3 setup.py apk \
176176
--ndk-dir=/media/DEVEL/Android/android-ndk-r20 \
177177
--sdk-dir=/media/DEVEL/Android/android-sdk-linux \
178-
--android-api=27 \
178+
--android-api=36 \
179179
--arch=arm64-v8a \
180180
--debug
181181

pythonforandroid/bootstrap.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
rmdir, move)
1515
from pythonforandroid.recipe import Recipe
1616

17+
SDL_BOOTSTRAPS = ("sdl2", "sdl3")
18+
1719

1820
def copy_files(src_root, dest_root, override=True, symlink=False):
1921
for root, dirnames, filenames in walk(src_root):
@@ -39,7 +41,7 @@ def copy_files(src_root, dest_root, override=True, symlink=False):
3941

4042

4143
default_recipe_priorities = [
42-
"webview", "sdl2", "service_only" # last is highest
44+
"webview", "sdl2", "sdl3", "service_only" # last is highest
4345
]
4446
# ^^ NOTE: these are just the default priorities if no special rules
4547
# apply (which you can find in the code below), so basically if no
@@ -150,18 +152,18 @@ def get_bootstrap_dirs(self):
150152
return bootstrap_dirs
151153

152154
def _copy_in_final_files(self):
153-
if self.name == "sdl2":
154-
# Get the paths for copying SDL2's java source code:
155-
sdl2_recipe = Recipe.get_recipe("sdl2", self.ctx)
156-
sdl2_build_dir = sdl2_recipe.get_jni_dir()
157-
src_dir = join(sdl2_build_dir, "SDL", "android-project",
155+
if self.name in SDL_BOOTSTRAPS:
156+
# Get the paths for copying SDL's java source code:
157+
sdl_recipe = Recipe.get_recipe(self.name, self.ctx)
158+
sdl_build_dir = sdl_recipe.get_jni_dir()
159+
src_dir = join(sdl_build_dir, "SDL", "android-project",
158160
"app", "src", "main", "java",
159161
"org", "libsdl", "app")
160162
target_dir = join(self.dist_dir, 'src', 'main', 'java', 'org',
161163
'libsdl', 'app')
162164

163165
# Do actual copying:
164-
info('Copying in SDL2 .java files from: ' + str(src_dir))
166+
info('Copying in SDL .java files from: ' + str(src_dir))
165167
if not os.path.exists(target_dir):
166168
os.makedirs(target_dir)
167169
copy_files(src_dir, target_dir, override=True)
@@ -193,7 +195,7 @@ def assemble_distribution(self):
193195
@classmethod
194196
def all_bootstraps(cls):
195197
'''Find all the available bootstraps and return them.'''
196-
forbidden_dirs = ('__pycache__', 'common')
198+
forbidden_dirs = ('__pycache__', 'common', '_sdl_common')
197199
bootstraps_dir = join(dirname(__file__), 'bootstraps')
198200
result = set()
199201
for name in listdir(bootstraps_dir):
@@ -272,6 +274,13 @@ def have_dependency_in_recipes(dep):
272274
info('Using sdl2 bootstrap since it is in dependencies')
273275
return cls.get_bootstrap("sdl2", ctx)
274276

277+
# Special rule: return SDL3 bootstrap if there's an sdl3 dep:
278+
if (have_dependency_in_recipes("sdl3") and
279+
"sdl3" in [b.name for b in acceptable_bootstraps]
280+
):
281+
info('Using sdl3 bootstrap since it is in dependencies')
282+
return cls.get_bootstrap("sdl3", ctx)
283+
275284
# Special rule: return "webview" if we depend on common web recipe:
276285
for possible_web_dep in known_web_packages:
277286
if have_dependency_in_recipes(possible_web_dep):
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
from os.path import join
2+
3+
import sh
4+
5+
from pythonforandroid.toolchain import (
6+
Bootstrap, shprint, current_directory, info, info_main)
7+
from pythonforandroid.util import ensure_dir, rmdir
8+
9+
10+
class SDLGradleBootstrap(Bootstrap):
11+
name = "_sdl_common"
12+
13+
recipe_depends = []
14+
15+
def assemble_distribution(self):
16+
info_main("# Creating Android project ({})".format(self.name))
17+
18+
rmdir(self.dist_dir)
19+
info("Copying SDL/gradle build")
20+
shprint(sh.cp, "-r", self.build_dir, self.dist_dir)
21+
22+
# either the build use environment variable (ANDROID_HOME)
23+
# or the local.properties if exists
24+
with current_directory(self.dist_dir):
25+
with open('local.properties', 'w') as fileh:
26+
fileh.write('sdk.dir={}'.format(self.ctx.sdk_dir))
27+
28+
with current_directory(self.dist_dir):
29+
info("Copying Python distribution")
30+
31+
self.distribute_javaclasses(self.ctx.javaclass_dir,
32+
dest_dir=join("src", "main", "java"))
33+
34+
for arch in self.ctx.archs:
35+
python_bundle_dir = join(f'_python_bundle__{arch.arch}', '_python_bundle')
36+
ensure_dir(python_bundle_dir)
37+
38+
self.distribute_libs(arch, [self.ctx.get_libs_dir(arch.arch)])
39+
site_packages_dir = self.ctx.python_recipe.create_python_bundle(
40+
join(self.dist_dir, python_bundle_dir), arch)
41+
if not self.ctx.with_debug_symbols:
42+
self.strip_libraries(arch)
43+
self.fry_eggs(site_packages_dir)
44+
45+
if 'sqlite3' not in self.ctx.recipe_build_order:
46+
with open('blacklist.txt', 'a') as fileh:
47+
fileh.write('\nsqlite3/*\nlib-dynload/_sqlite3.so\n')
48+
49+
super().assemble_distribution()
File renamed without changes.

0 commit comments

Comments
 (0)