Skip to content

Commit 0daa74c

Browse files
misl6DexerBRAndreMirasBitcoinWukongkuzeyron
authored
Merge pull request #2796 from misl6/release-2023.05.21
* Add support for Python 3.10 and make it the default while building hostpython3 and python3 (#2577) * Add support for Python 3.10 and make it the default while building hostpython3 and python3 * Update bugfix version * Add PyAV recipe (#2750) * pyav recipe * flake8 fix * Update pythonforandroid/recipes/av/__init__.py Co-authored-by: Andre Miras <AndreMiras@users.noreply.github.com> --------- Co-authored-by: Andre Miras <AndreMiras@users.noreply.github.com> * Add debug loggings for identifying a matching dist (#2751) * Add debug loggings for identifying a matching dist * Fix lint failure on f-string. * Adds flag to support home app (launcher) intent-filter on SDL2 bootstrap (#2761) * Home app functionality * Cleanup * Added --home-app to the docs * Fixed the if statements within the intent-filter * Use io.IOBase for LogFile (#2763) This provides reasonable default implementations for common IO class methods such as isatty(). Closes #2762. * android_api to integer (#2765) * android_api to integer * changes to android_api * changes to android_api * fix #2768 smallIconName null can t be compared to String (#2769) * fix #2768 smallIconName null can t be compared to String * fix: Remove Importance None of notification which is modification from my own fork * fix: Readd Importance_NONE in the notification channel as it s also in upstream p4a * fix tools/liblink: syntax error regression from 22b7dfe * Update pyjnius version in recipe (#2791) * Update Kivy recipe for 2.2.0 (#2793) * Update Kivy recipe for 2.2.0rc1 * Bump to 2.2.0 * Update CHANGELOG.md and bump version to 2023.05.21 --------- Co-authored-by: Dexer <73297572+DexerBR@users.noreply.github.com> Co-authored-by: Andre Miras <AndreMiras@users.noreply.github.com> Co-authored-by: BitcoinWukong <87334822+BitcoinWukong@users.noreply.github.com> Co-authored-by: Mathias Lindström <kuzeyron@gmail.com> Co-authored-by: Dylan McCall <dylan@dylanmccall.ca> Co-authored-by: Benoît HERVIER <b@rvier.fr> Co-authored-by: SomberNight <somber.night@protonmail.com>
2 parents 56bf733 + 11c38b4 commit 0daa74c

File tree

16 files changed

+142
-36
lines changed

16 files changed

+142
-36
lines changed

CHANGELOG.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,45 @@
11
# Changelog
22

3+
## [v2023.05.21](https://github.com/kivy/python-for-android/tree/v2023.05.21)
4+
5+
[Full Changelog](https://github.com/kivy/python-for-android/compare/v2023.02.10...v2023.05.21)
6+
7+
**Closed issues:**
8+
9+
- python [\#2795](https://github.com/kivy/python-for-android/issues/2795)
10+
- Create APK from PyQt app [\#2794](https://github.com/kivy/python-for-android/issues/2794)
11+
- psutil/\_psutil\_linux.so" is 64-bit instead of 32-bit [\#2785](https://github.com/kivy/python-for-android/issues/2785)
12+
- pythonforandroid.toolchain.py: error: unrecognized arguments: --dir [\#2775](https://github.com/kivy/python-for-android/issues/2775)
13+
- App [\#2774](https://github.com/kivy/python-for-android/issues/2774)
14+
- org.kivy.android.PythonActivity$NewIntentListener is not visible from class loader java.lang.IllegalArgumentException [\#2770](https://github.com/kivy/python-for-android/issues/2770)
15+
- Service don t start anymore, as smallIconName extra is now mandatory [\#2768](https://github.com/kivy/python-for-android/issues/2768)
16+
- Start a background sticky service that auto-restart. [\#2767](https://github.com/kivy/python-for-android/issues/2767)
17+
- Fail installation [\#2764](https://github.com/kivy/python-for-android/issues/2764)
18+
- Python exception when using colorlog due to incomplete IO implementation in sys.stderr [\#2762](https://github.com/kivy/python-for-android/issues/2762)
19+
- AttributeError: 'org.kivy.android.PythonService' object has no attribute 'getComponentName' [\#2760](https://github.com/kivy/python-for-android/issues/2760)
20+
- https://code.videolan.org not available [\#2758](https://github.com/kivy/python-for-android/issues/2758)
21+
- Cannot install Python-for-Android [\#2754](https://github.com/kivy/python-for-android/issues/2754)
22+
- c/\_cffi\_backend.c:407:23: error: expression is not assignable [\#2753](https://github.com/kivy/python-for-android/issues/2753)
23+
- not install [\#2749](https://github.com/kivy/python-for-android/issues/2749)
24+
- APK crashes upon launch. logcat error: null pointer dereference \(occurs with imported modules\) [\#2358](https://github.com/kivy/python-for-android/issues/2358)
25+
- Error occured while building the aplication using buildozer [\#2104](https://github.com/kivy/python-for-android/issues/2104)
26+
- "Could Not Extract Public Data" Needs very explicit instructions or feedback to the user [\#260](https://github.com/kivy/python-for-android/issues/260)
27+
28+
**Merged pull requests:**
29+
30+
- Update Kivy recipe for 2.2.0 [\#2793](https://github.com/kivy/python-for-android/pull/2793) ([misl6](https://github.com/misl6))
31+
- Update `pyjnius` version to `1.5.0` [\#2791](https://github.com/kivy/python-for-android/pull/2791) ([misl6](https://github.com/misl6))
32+
- fix tools/liblink: syntax error [\#2771](https://github.com/kivy/python-for-android/pull/2771) ([SomberNight](https://github.com/SomberNight))
33+
- fix \#2768 smallIconName null can t be compared to String [\#2769](https://github.com/kivy/python-for-android/pull/2769) ([brvier](https://github.com/brvier))
34+
- android\_api to integer [\#2765](https://github.com/kivy/python-for-android/pull/2765) ([kuzeyron](https://github.com/kuzeyron))
35+
- Use io.IOBase for LogFile [\#2763](https://github.com/kivy/python-for-android/pull/2763) ([dylanmccall](https://github.com/dylanmccall))
36+
- Home app functionality [\#2761](https://github.com/kivy/python-for-android/pull/2761) ([kuzeyron](https://github.com/kuzeyron))
37+
- Add debug loggings for identifying a matching dist [\#2751](https://github.com/kivy/python-for-android/pull/2751) ([BitcoinWukong](https://github.com/BitcoinWukong))
38+
- Add PyAV recipe [\#2750](https://github.com/kivy/python-for-android/pull/2750) ([DexerBR](https://github.com/DexerBR))
39+
- Merge master into develop [\#2748](https://github.com/kivy/python-for-android/pull/2748) ([misl6](https://github.com/misl6))
40+
- Add support for Python 3.10 and make it the default while building hostpython3 and python3 [\#2577](https://github.com/kivy/python-for-android/pull/2577) ([misl6](https://github.com/misl6))
41+
42+
343
## [v2023.02.10](https://github.com/kivy/python-for-android/tree/v2023.02.10) (2023-02-10)
444

545
[Full Changelog](https://github.com/kivy/python-for-android/compare/v2023.01.28...v2023.02.10)

doc/source/buildoptions.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ options (this list may not be exhaustive):
7171
- ``--icon``: A path to the png file to use as the application icon.
7272
- ``--permission``: A permission that needs to be declared into the App ``AndroidManifest.xml``.
7373
For multiple permissions, add multiple ``--permission`` arguments.
74+
``--home-app`` Gives you the option to set your application as a home app (launcher) on your Android device.
7475

7576
.. Note ::
7677
``--permission`` accepts the following syntaxes:

pythonforandroid/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '2023.02.10'
1+
__version__ = '2023.05.21'

pythonforandroid/bootstraps/common/build/build.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -498,14 +498,16 @@ def make_package(args):
498498
with open('project.properties', 'r') as fileh:
499499
target = fileh.read().strip()
500500
android_api = target.split('-')[1]
501-
try:
502-
int(android_api)
503-
except (ValueError, TypeError):
501+
502+
if android_api.isdigit():
503+
android_api = int(android_api)
504+
else:
504505
raise ValueError(
505506
"failed to extract the Android API level from " +
506507
"build.properties. expected int, got: '" +
507508
str(android_api) + "'"
508509
)
510+
509511
with open('local.properties', 'r') as fileh:
510512
sdk_dir = fileh.read().strip()
511513
sdk_dir = sdk_dir[8:]
@@ -773,6 +775,8 @@ def create_argument_parser():
773775
ap.add_argument('--launcher', dest='launcher', action='store_true',
774776
help=('Provide this argument to build a multi-app '
775777
'launcher, rather than a single app.'))
778+
ap.add_argument('--home-app', dest='home_app', action='store_true', default=False,
779+
help=('Turn your application into a home app (launcher)'))
776780
ap.add_argument('--permission', dest='permissions', action='append', default=[],
777781
help='The permissions to give this app.', nargs='+')
778782
ap.add_argument('--meta-data', dest='meta_data', action='append', default=[],

pythonforandroid/bootstraps/common/build/jni/application/src/start.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ int main(int argc, char *argv[]) {
206206
/* inject our bootstrap code to redirect python stdin/stdout
207207
* replace sys.path with our path
208208
*/
209-
PyRun_SimpleString("import sys, posix\n");
209+
PyRun_SimpleString("import io, sys, posix\n");
210210

211211
char add_site_packages_dir[256];
212212

@@ -224,17 +224,19 @@ int main(int argc, char *argv[]) {
224224
}
225225

226226
PyRun_SimpleString(
227-
"class LogFile(object):\n"
227+
"class LogFile(io.IOBase):\n"
228228
" def __init__(self):\n"
229229
" self.__buffer = ''\n"
230+
" def readable(self):\n"
231+
" return False\n"
232+
" def writable(self):\n"
233+
" return True\n"
230234
" def write(self, s):\n"
231235
" s = self.__buffer + s\n"
232236
" lines = s.split('\\n')\n"
233237
" for l in lines[:-1]:\n"
234238
" androidembed.log(l.replace('\\x00', ''))\n"
235239
" self.__buffer = lines[-1]\n"
236-
" def flush(self):\n"
237-
" return\n"
238240
"sys.stdout = sys.stderr = LogFile()\n"
239241
"print('Android path', sys.path)\n"
240242
"import os\n"

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

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -113,18 +113,20 @@ protected void doStartForeground(Bundle extras) {
113113

114114
// Unspecified icon uses default.
115115
int smallIconId = context.getApplicationInfo().icon;
116-
if (!smallIconName.equals("")){
117-
int resId = getResources().getIdentifier(smallIconName, "mipmap",
118-
getPackageName());
119-
if (resId ==0) {
120-
resId = getResources().getIdentifier(smallIconName, "drawable",
121-
getPackageName());
122-
}
123-
if (resId !=0) {
124-
smallIconId = resId;
125-
}
126-
}
127-
116+
if (smallIconName != null) {
117+
if (!smallIconName.equals("")){
118+
int resId = getResources().getIdentifier(smallIconName, "mipmap",
119+
getPackageName());
120+
if (resId ==0) {
121+
resId = getResources().getIdentifier(smallIconName, "drawable",
122+
getPackageName());
123+
}
124+
if (resId !=0) {
125+
smallIconId = resId;
126+
}
127+
}
128+
}
129+
128130
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
129131
// This constructor is deprecated
130132
notification = new Notification(
@@ -143,9 +145,8 @@ protected void doStartForeground(Bundle extras) {
143145
// https://stackoverflow.com/questions/47531742/startforeground-fail-after-upgrade-to-android-8-1
144146
String NOTIFICATION_CHANNEL_ID = "org.kivy.p4a" + getServiceId();
145147
String channelName = "Background Service" + getServiceId();
146-
NotificationChannel chan = new NotificationChannel(NOTIFICATION_CHANNEL_ID, channelName,
147-
NotificationManager.IMPORTANCE_NONE);
148-
148+
NotificationChannel chan = new NotificationChannel(NOTIFICATION_CHANNEL_ID, channelName, NotificationManager.IMPORTANCE_NONE);
149+
149150
chan.setLightColor(Color.BLUE);
150151
chan.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
151152
NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ protected static ArrayList<String> getLibraries(File libsDir) {
5454
libsList.add("python3.7m");
5555
libsList.add("python3.8");
5656
libsList.add("python3.9");
57+
libsList.add("python3.10");
5758
libsList.add("main");
5859
return libsList;
5960
}
@@ -73,7 +74,7 @@ public static void loadLibraries(File filesDir, File libsDir) {
7374
// load, and it has failed, give a more
7475
// general error
7576
Log.v(TAG, "Library loading error: " + e.getMessage());
76-
if (lib.startsWith("python3.9") && !foundPython) {
77+
if (lib.startsWith("python3.10") && !foundPython) {
7778
throw new RuntimeException("Could not load any libpythonXXX.so");
7879
} else if (lib.startsWith("python")) {
7980
continue;

pythonforandroid/bootstraps/sdl2/build/templates/AndroidManifest.tmpl.xml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,22 @@
7676
{% endif %}
7777
>
7878

79-
{% if args.launcher %}
8079
<intent-filter>
80+
{% if args.launcher %}
8181
<action android:name="org.kivy.LAUNCH" />
8282
<category android:name="android.intent.category.DEFAULT" />
8383
<data android:scheme="{{ url_scheme }}" />
84-
</intent-filter>
8584
{% else %}
86-
<intent-filter>
8785
<action android:name="android.intent.action.MAIN" />
8886
<category android:name="android.intent.category.LAUNCHER" />
89-
</intent-filter>
9087
{% endif %}
9188

89+
{% if args.home_app %}
90+
<category android:name="android.intent.category.HOME" />
91+
<category android:name="android.intent.category.DEFAULT" />
92+
{% endif %}
93+
</intent-filter>
94+
9295
{%- if args.intent_filters -%}
9396
{{- args.intent_filters -}}
9497
{%- endif -%}

pythonforandroid/distribution.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import glob
33
import json
44

5-
from pythonforandroid.logger import (info, info_notify, warning, Err_Style, Err_Fore)
5+
from pythonforandroid.logger import (debug, info, info_notify, warning, Err_Style, Err_Fore)
66
from pythonforandroid.util import current_directory, BuildInterruptingException
77
from shutil import rmtree
88

@@ -91,6 +91,7 @@ def get_distribution(
9191
'''
9292

9393
possible_dists = Distribution.get_distributions(ctx)
94+
debug(f"All possible dists: {possible_dists}")
9495

9596
# Will hold dists that would be built in the same folder as an existing dist
9697
folder_match_dist = None
@@ -100,6 +101,7 @@ def get_distribution(
100101
possible_dists = [
101102
d for d in possible_dists if
102103
(d.name == name) and all(arch_name in d.archs for arch_name in archs)]
104+
debug(f"Dist matching name and arch: {possible_dists}")
103105

104106
if possible_dists:
105107
# There should only be one folder with a given dist name *and* arch.
@@ -115,13 +117,18 @@ def get_distribution(
115117
if (
116118
ndk_api is not None and dist.ndk_api != ndk_api
117119
) or dist.ndk_api is None:
120+
debug(
121+
f"dist {dist} failed to match ndk_api, target api {ndk_api}, dist api {dist.ndk_api}"
122+
)
118123
continue
119124
for recipe in recipes:
120125
if recipe not in dist.recipes:
126+
debug(f"dist {dist} missing recipe {recipe}")
121127
break
122128
else:
123129
_possible_dists.append(dist)
124130
possible_dists = _possible_dists
131+
debug(f"Dist matching ndk_api and recipe: {possible_dists}")
125132

126133
if possible_dists:
127134
info('Of the existing distributions, the following meet '
@@ -133,17 +140,24 @@ def get_distribution(
133140
# If any dist has perfect recipes, arch and NDK API, return it
134141
for dist in possible_dists:
135142
if force_build:
143+
debug("Skipping dist due to forced build")
136144
continue
137145
if ndk_api is not None and dist.ndk_api != ndk_api:
146+
debug("Skipping dist due to ndk_api mismatch")
138147
continue
139148
if not all(arch_name in dist.archs for arch_name in archs):
149+
debug("Skipping dist due to arch mismatch")
140150
continue
141151
if (set(dist.recipes) == set(recipes) or
142152
(set(recipes).issubset(set(dist.recipes)) and
143153
not require_perfect_match)):
144154
info_notify('{} has compatible recipes, using this one'
145155
.format(dist.name))
146156
return dist
157+
else:
158+
debug(
159+
f"Skipping dist due to recipes mismatch, expected {set(recipes)}, actual {set(dist.recipes)}"
160+
)
147161

148162
# If there was a name match but we didn't already choose it,
149163
# then the existing dist is incompatible with the requested
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from pythonforandroid.toolchain import Recipe
2+
from pythonforandroid.recipe import CythonRecipe
3+
4+
5+
class PyAVRecipe(CythonRecipe):
6+
7+
name = "av"
8+
version = "10.0.0"
9+
url = "https://github.com/PyAV-Org/PyAV/archive/v{version}.zip"
10+
11+
depends = ["python3", "cython", "ffmpeg", "av_codecs"]
12+
opt_depends = ["openssl"]
13+
14+
def get_recipe_env(self, arch, with_flags_in_cc=True):
15+
env = super().get_recipe_env(arch)
16+
17+
build_dir = Recipe.get_recipe("ffmpeg", self.ctx).get_build_dir(
18+
arch.arch
19+
)
20+
self.setup_extra_args = ["--ffmpeg-dir={}".format(build_dir)]
21+
22+
return env
23+
24+
25+
recipe = PyAVRecipe()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy