Skip to content

Release 2022.09.04 #2666

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Sep 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
8350dfd
Add option for copying arbitratry xml files to src/main/res/xml witho…
rambo Oct 2, 2020
214047f
handle the case of getting list as res_xml
rambo Oct 2, 2020
3353fbf
Merge pull request #2639 from kivy/master
misl6 Jul 20, 2022
54575ae
Remove stray - in output file name
dbnicholson Apr 18, 2022
93c7bab
Merge pull request #2581 from dbnicholson/package-filename
AndreMiras Jul 22, 2022
b3e8c03
Resolve absolute path to local recipes (#2640)
dbnicholson Jul 22, 2022
fd98534
Fix webview Back button behaviour (#2636)
interlark Jul 23, 2022
715ee8a
Merge pull request #2330 from advian-oss/res_xml
akshayaurora Jul 26, 2022
cdbee35
Fixes TypeError: str.join() takes exactly one argument (2 given) in h…
Furtif Jul 26, 2022
70c2dd3
RTSP support for ffmpeg
Jul 26, 2022
c77e07d
Merge pull request #2644 from alicakici1234/rtspSupport4ffmpeg
AndreMiras Jul 27, 2022
36b17aa
Fixes some E275 - assert is a keyword. (#2647)
misl6 Jul 31, 2022
e8686e2
Add icon-bg and icon-fg to fix_args + adds a missing folder in webvie…
danigm Aug 4, 2022
17395de
Updates matplotlib, fixes an issue related to shared libc++ (#2645)
misl6 Aug 16, 2022
1e270c5
Update supported Python versions (#2656)
misl6 Aug 18, 2022
1f62452
Remove six and enum34 dependency (#2657)
misl6 Aug 18, 2022
cea7b2d
Force --platform=linux/amd64 in Dockerfile (#2660)
misl6 Aug 23, 2022
5e2d44f
Use p4a_install instead of install, as a file named INSTALL is alread…
misl6 Sep 2, 2022
686c385
Update CHANGELOG.md & change version for release 2022.09.04
misl6 Sep 4, 2022
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
6 changes: 3 additions & 3 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: Unit tests & build apps
on: ['push', 'pull_request']

env:
APK_ARTIFACT_FILENAME: bdist_unit_tests_app-debug-1.1-.apk
AAB_ARTIFACT_FILENAME: bdist_unit_tests_app-release-1.1-.aab
AAR_ARTIFACT_FILENAME: bdist_unit_tests_app-release-1.1-.aar
APK_ARTIFACT_FILENAME: bdist_unit_tests_app-debug-1.1.apk
AAB_ARTIFACT_FILENAME: bdist_unit_tests_app-release-1.1.aab
AAR_ARTIFACT_FILENAME: bdist_unit_tests_app-release-1.1.aar
PYTHONFORANDROID_PREREQUISITES_INSTALL_INTERACTIVE: 0

jobs:
Expand Down
43 changes: 43 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,48 @@
# Changelog

## [v2022.09.04](https://github.com/kivy/python-for-android/tree/v2022.09.04) (2022-09-04)

[Full Changelog](https://github.com/kivy/python-for-android/compare/v2022.07.20...v2022.09.04)

**Fixed bugs:**

- Matplotlib failed to import properly on an APK from Buildozer and Kivy [\#2643](https://github.com/kivy/python-for-android/issues/2643)

**Closed issues:**

- KeyError: Matplotlib with kivy android [\#2658](https://github.com/kivy/python-for-android/issues/2658)
- KeyError: Matplotlib [\#2659](https://github.com/kivy/python-for-android/issues/2659)
- Upgrade from NDK 19b to 23b causes problems with Pandas library [\#2654](https://github.com/kivy/python-for-android/issues/2654)
- Update Dockerfile for ARM [\#2653](https://github.com/kivy/python-for-android/issues/2653)
- Apple M2 chip doesn't generate apk: compiling error on liblzma [\#2652](https://github.com/kivy/python-for-android/issues/2652)
- aiohttp/\_http\_parser.pyx:46:0: '\_headers.pxi' not found [\#2651](https://github.com/kivy/python-for-android/issues/2651)
- \[Question\] Pip SSL ? [\#2649](https://github.com/kivy/python-for-android/issues/2649)
- Colab gives me as error "No module named 'typing\_extensions' ", even if before with the same compilation it worked [\#2648](https://github.com/kivy/python-for-android/issues/2648)
- \[Question\] Java Files [\#2646](https://github.com/kivy/python-for-android/issues/2646)
- Using foreground services will cause wired behaviour on Android 8 [\#2641](https://github.com/kivy/python-for-android/issues/2641)
- Can't apply patches with relative paths for local recipe [\#2623](https://github.com/kivy/python-for-android/issues/2623)
- Compile for x86 on MacOS [\#2215](https://github.com/kivy/python-for-android/issues/2215)
- splash always loading [\#1907](https://github.com/kivy/python-for-android/issues/1907)
- python-for-android.readthedocs.io has problems updating, apparently [\#1709](https://github.com/kivy/python-for-android/issues/1709)
- Webview apps not working on Android [\#1644](https://github.com/kivy/python-for-android/issues/1644)

**Merged pull requests:**

- `liblzma`: Use `p4a_install` instead of `install`, as a file named `INSTALL` is already present. [\#2663](https://github.com/kivy/python-for-android/pull/2663) ([misl6](https://github.com/misl6))
- Force `--platform=linux/amd64` in Dockerfile [\#2660](https://github.com/kivy/python-for-android/pull/2660) ([misl6](https://github.com/misl6))
- Remove six and enum34 dependency [\#2657](https://github.com/kivy/python-for-android/pull/2657) ([misl6](https://github.com/misl6))
- Update supported Python versions [\#2656](https://github.com/kivy/python-for-android/pull/2656) ([misl6](https://github.com/misl6))
- Fixes some E275 - assert is a keyword. [\#2647](https://github.com/kivy/python-for-android/pull/2647) ([misl6](https://github.com/misl6))
- Updates matplotlib, fixes an issue related to shared libc++ [\#2645](https://github.com/kivy/python-for-android/pull/2645) ([misl6](https://github.com/misl6))
- RTSP support for ffmpeg [\#2644](https://github.com/kivy/python-for-android/pull/2644) ([alicakici1234](https://github.com/alicakici1234))
- Fixes TypeError: str.join\(\) takes exactly one argument \(2 given\) in hostpython3/\_\_init\_\_.py", line 69 [\#2642](https://github.com/kivy/python-for-android/pull/2642) ([Furtif](https://github.com/Furtif))
- Resolve absolute path to local recipes [\#2640](https://github.com/kivy/python-for-android/pull/2640) ([dbnicholson](https://github.com/dbnicholson))
- Merges master into develop after release 2022.07.20 [\#2639](https://github.com/kivy/python-for-android/pull/2639) ([misl6](https://github.com/misl6))
- Fix webview Back button behaviour [\#2636](https://github.com/kivy/python-for-android/pull/2636) ([interlark](https://github.com/interlark))
- Add icon-bg and icon-fg to fix\_args [\#2633](https://github.com/kivy/python-for-android/pull/2633) ([danigm](https://github.com/danigm))
- Remove stray - in output file name [\#2581](https://github.com/kivy/python-for-android/pull/2581) ([dbnicholson](https://github.com/dbnicholson))
- Add option for adding files to res/xml without touching manifest [\#2330](https://github.com/kivy/python-for-android/pull/2330) ([rambo](https://github.com/rambo))

## [v2022.07.20](https://github.com/kivy/python-for-android/tree/v2022.07.20) (2022-07-20)

[Full Changelog](https://github.com/kivy/python-for-android/compare/v2022.03.13...v2022.07.20)
Expand Down
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
# Use 'docker run' without '--rm' flag for keeping the container and use
# 'docker commit <container hash> <new image>' to extend the original image

FROM ubuntu:20.04
# If platform is not specified, by default the target platform of the build request is used.
# This is not what we want, as Google doesn't provide a linux/arm64 compatible NDK.
# See: https://docs.docker.com/engine/reference/builder/#from
FROM --platform=linux/amd64 ubuntu:20.04

# configure locale
RUN apt -y update -qq > /dev/null \
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,17 @@ docker/run/command: docker/build

docker/run/make/with-artifact/apk/%: docker/build
docker run --name p4a-latest --env-file=.env $(DOCKER_IMAGE) make $*
docker cp p4a-latest:/home/user/app/testapps/on_device_unit_tests/bdist_unit_tests_app-debug-1.1-.apk ./apks
docker cp p4a-latest:/home/user/app/testapps/on_device_unit_tests/bdist_unit_tests_app-debug-1.1.apk ./apks
docker rm -fv p4a-latest

docker/run/make/with-artifact/aar/%: docker/build
docker run --name p4a-latest --env-file=.env $(DOCKER_IMAGE) make $*
docker cp p4a-latest:/home/user/app/testapps/on_device_unit_tests/bdist_unit_tests_app-release-1.1-.aar ./aars
docker cp p4a-latest:/home/user/app/testapps/on_device_unit_tests/bdist_unit_tests_app-release-1.1.aar ./aars
docker rm -fv p4a-latest

docker/run/make/with-artifact/aab/%: docker/build
docker run --name p4a-latest --env-file=.env $(DOCKER_IMAGE) make $*
docker cp p4a-latest:/home/user/app/testapps/on_device_unit_tests/bdist_unit_tests_app-release-1.1-.aab ./aabs
docker cp p4a-latest:/home/user/app/testapps/on_device_unit_tests/bdist_unit_tests_app-release-1.1.aab ./aabs
docker rm -fv p4a-latest

docker/run/make/rebuild_updated_recipes: docker/build
Expand Down
2 changes: 1 addition & 1 deletion pythonforandroid/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2022.07.20'
__version__ = '2022.09.04'
15 changes: 14 additions & 1 deletion pythonforandroid/bootstraps/common/build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,12 +508,20 @@ def make_package(args):
url_scheme = 'kivy'

# Copy backup rules file if specified and update the argument
res_xml_dir = join(res_dir, 'xml')
if args.backup_rules:
res_xml_dir = join(res_dir, 'xml')
ensure_dir(res_xml_dir)
shutil.copy(join(args.private, args.backup_rules), res_xml_dir)
args.backup_rules = split(args.backup_rules)[1][:-4]

# Copy res_xml files to src/main/res/xml
if args.res_xmls:
ensure_dir(res_xml_dir)
for xmlpath in args.res_xmls:
if not os.path.exists(xmlpath):
xmlpath = join(args.private, xmlpath)
shutil.copy(xmlpath, res_xml_dir)

# Render out android manifest:
manifest_path = "src/main/AndroidManifest.xml"
render_args = {
Expand Down Expand Up @@ -803,6 +811,8 @@ def parse_args_and_make_package(args=None):
'filename containing xml. The filename should be '
'located relative to the python-for-android '
'directory'))
ap.add_argument('--res_xml', dest='res_xmls', action='append', default=[],
help='Add files to res/xml directory (for example device-filters)', nargs='+')
ap.add_argument('--with-billing', dest='billing_pubkey',
help='If set, the billing service will be added (not implemented)')
ap.add_argument('--add-source', dest='extra_source_dirs', action='append',
Expand Down Expand Up @@ -901,6 +911,9 @@ def _read_configuration():
if args.permissions and isinstance(args.permissions[0], list):
args.permissions = [p for perm in args.permissions for p in perm]

if args.res_xmls and isinstance(args.res_xmls[0], list):
args.res_xmls = [x for res in args.res_xmls for x in res]

if args.try_system_python_compile:
# Hardcoding python2.7 is okay for now, as python3 skips the
# compilation anyway
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,19 +177,22 @@ public void loadLibraries() {
new File(getApplicationInfo().nativeLibraryDir));
}

long lastBackClick = SystemClock.elapsedRealtime();
long lastBackClick = 0;
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
// If it wasn't the Back key or there's no web page history, bubble up to the default
// system behavior (probably exit the activity)
if (SystemClock.elapsedRealtime() - lastBackClick > 2000){
// Check if the key event was the Back button
if (keyCode == KeyEvent.KEYCODE_BACK) {
// If there's no web page history, bubble up to the default
// system behavior (probably exit the activity)
if (SystemClock.elapsedRealtime() - lastBackClick > 2000){
lastBackClick = SystemClock.elapsedRealtime();
Toast.makeText(this, "Tap again to close the app", Toast.LENGTH_LONG).show();
return true;
}

lastBackClick = SystemClock.elapsedRealtime();
Toast.makeText(this, "Click again to close the app",
Toast.LENGTH_LONG).show();
return true;
}

lastBackClick = SystemClock.elapsedRealtime();
return super.onKeyDown(keyCode, event);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import android.widget.AbsoluteLayout;
import android.view.ViewGroup.LayoutParams;

import android.webkit.WebBackForwardList;
import android.webkit.WebViewClient;
import android.webkit.WebView;
import android.webkit.CookieManager;
Expand Down Expand Up @@ -269,24 +270,30 @@ public static ViewGroup getLayout() {
return mLayout;
}

long lastBackClick = SystemClock.elapsedRealtime();
long lastBackClick = 0;
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
// Check if the key event was the Back button and if there's history
if ((keyCode == KeyEvent.KEYCODE_BACK) && mWebView.canGoBack()) {
mWebView.goBack();
return true;
}
// If it wasn't the Back key or there's no web page history, bubble up to the default
// system behavior (probably exit the activity)
if (SystemClock.elapsedRealtime() - lastBackClick > 2000){
// Check if the key event was the Back button
if (keyCode == KeyEvent.KEYCODE_BACK) {
// Go back if there is web page history behind,
// but not to the start preloader
WebBackForwardList webViewBackForwardList = mWebView.copyBackForwardList();
if (webViewBackForwardList.getCurrentIndex() > 1) {
mWebView.goBack();
return true;
}

// If there's no web page history, bubble up to the default
// system behavior (probably exit the activity)
if (SystemClock.elapsedRealtime() - lastBackClick > 2000){
lastBackClick = SystemClock.elapsedRealtime();
Toast.makeText(this, "Tap again to close the app", Toast.LENGTH_LONG).show();
return true;
}

lastBackClick = SystemClock.elapsedRealtime();
Toast.makeText(this, "Click again to close the app",
Toast.LENGTH_LONG).show();
return true;
}

lastBackClick = SystemClock.elapsedRealtime();
return super.onKeyDown(keyCode, event);
}

Expand Down
2 changes: 1 addition & 1 deletion pythonforandroid/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def get_dependency_tuple_list_for_recipe(recipe, blacklist=None):
"""
if blacklist is None:
blacklist = set()
assert(type(blacklist) == set)
assert type(blacklist) == set
if recipe.depends is None:
dependencies = []
else:
Expand Down
21 changes: 3 additions & 18 deletions pythonforandroid/recipe.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from os.path import basename, dirname, exists, isdir, isfile, join, realpath, split
import glob
from shutil import rmtree
from six import with_metaclass

import hashlib
from re import match
Expand Down Expand Up @@ -40,7 +39,7 @@ def __new__(cls, name, bases, dct):
return super().__new__(cls, name, bases, dct)


class Recipe(with_metaclass(RecipeMeta)):
class Recipe(metaclass=RecipeMeta):
_url = None
'''The address from which the recipe may be downloaded. This is not
essential, it may be omitted if the source is available some other
Expand Down Expand Up @@ -123,8 +122,8 @@ class Recipe(with_metaclass(RecipeMeta)):
"""

need_stl_shared = False
'''Some libraries or python packages may need to be linked with android's
stl. We can automatically do this for any recipe if we set this property to
'''Some libraries or python packages may need the c++_shared in APK.
We can automatically do this for any recipe if we set this property to
`True`'''

stl_lib_name = 'c++_shared'
Expand Down Expand Up @@ -492,20 +491,6 @@ def get_recipe_env(self, arch=None, with_flags_in_cc=True):
if arch is None:
arch = self.filtered_archs[0]
env = arch.get_env(with_flags_in_cc=with_flags_in_cc)

if self.need_stl_shared:
env['CPPFLAGS'] = env.get('CPPFLAGS', '')
env['CPPFLAGS'] += ' -I{}'.format(self.ctx.ndk.libcxx_include_dir)

env['CXXFLAGS'] = env['CFLAGS'] + ' -frtti -fexceptions'

if with_flags_in_cc:
env['CXX'] += ' -frtti -fexceptions'

env['LDFLAGS'] += ' -L{}'.format(arch.ndk_lib_dir)
env['LIBS'] = env.get('LIBS', '') + " -l{}".format(
self.stl_lib_name
)
return env

def prebuild_arch(self, arch):
Expand Down
5 changes: 1 addition & 4 deletions pythonforandroid/recipes/cppy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@

class CppyRecipe(PythonRecipe):
site_packages_name = 'cppy'

# Pin to commit: `Nucleic migration and project documentation`,
# because the official releases are too old, at time of writing
version = '4e0b956'
version = '1.1.0'
url = 'https://github.com/nucleic/cppy/archive/{version}.zip'
call_hostpython_via_targetpython = False
# to be detected by the matplotlib install script
Expand Down
4 changes: 2 additions & 2 deletions pythonforandroid/recipes/ffmpeg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def build_arch(self, arch):
'--enable-parser=aac,ac3,h261,h264,mpegaudio,mpeg4video,mpegvideo,vc1',
'--enable-decoder=aac,h264,mpeg4,mpegvideo',
'--enable-muxer=h264,mov,mp4,mpeg2video',
'--enable-demuxer=aac,h264,m4v,mov,mpegvideo,vc1',
'--enable-demuxer=aac,h264,m4v,mov,mpegvideo,vc1,rtsp',
]

# needed to prevent _ffmpeg.so: version node not found for symbol av_init_packet@LIBAVFORMAT_52
Expand All @@ -100,7 +100,7 @@ def build_arch(self, arch):
# other flags:
flags += [
'--enable-filter=aresample,resample,crop,adelay,volume,scale',
'--enable-protocol=file,http,hls',
'--enable-protocol=file,http,hls,udp,tcp',
'--enable-small',
'--enable-hwaccels',
'--enable-pic',
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 @@ -67,7 +67,7 @@ def get_recipe_env(self, arch=None):
openssl_prereq = OpenSSLPrerequisite()
if env.get("PKG_CONFIG_PATH", ""):
env["PKG_CONFIG_PATH"] = os.pathsep.join(
openssl_prereq.pkg_config_location, env["PKG_CONFIG_PATH"]
[openssl_prereq.pkg_config_location, env["PKG_CONFIG_PATH"]]
)
else:
env["PKG_CONFIG_PATH"] = openssl_prereq.pkg_config_location
Expand Down
21 changes: 1 addition & 20 deletions pythonforandroid/recipes/kiwisolver/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,9 @@

class KiwiSolverRecipe(CppCompiledComponentsPythonRecipe):
site_packages_name = 'kiwisolver'
# Pin to commit `docs: attempt to fix doc building`, the latest one
# at the time of writing, just to be sure that we have te most up to date
# version, but it should be pinned to an official release once the c++
# changes that we want to include are merged to master branch
# Note: the commit we want to include is
# `Cppy use update and c++11 compatibility` (4858730)
version = '0846189'
version = '1.3.2'
url = 'https://github.com/nucleic/kiwi/archive/{version}.zip'
depends = ['cppy']

def get_recipe_env(self, arch=None, with_flags_in_cc=True):
env = super().get_recipe_env(arch, with_flags_in_cc)
if self.need_stl_shared:
# kiwisolver compile flags does not honor the standard flags:
# `CPPFLAGS` and `LDLIBS`, so we put in `CFLAGS` and `LDFLAGS` to
# correctly link with the `c++_shared` library
env['CFLAGS'] += f' -I{self.ctx.ndk.libcxx_include_dir}'
env['CFLAGS'] += ' -frtti -fexceptions'

env['LDFLAGS'] += f' -L{arch.ndk_lib_dir}'
env['LDFLAGS'] += f' -l{self.stl_lib_name}'
return env


recipe = KiwiSolverRecipe()
9 changes: 4 additions & 5 deletions pythonforandroid/recipes/liblzma/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@
from pythonforandroid.archs import Arch
from pythonforandroid.logger import shprint
from pythonforandroid.recipe import Recipe
from pythonforandroid.util import current_directory, ensure_dir
from pythonforandroid.util import current_directory


class LibLzmaRecipe(Recipe):

version = '5.2.4'
url = 'https://tukaani.org/xz/xz-{version}.tar.gz'
built_libraries = {'liblzma.so': 'install/lib'}
built_libraries = {'liblzma.so': 'p4a_install/lib'}

def build_arch(self, arch: Arch) -> None:
env = self.get_recipe_env(arch)
install_dir = join(self.get_build_dir(arch.arch), 'install')
install_dir = join(self.get_build_dir(arch.arch), 'p4a_install')
with current_directory(self.get_build_dir(arch.arch)):
if not exists('configure'):
shprint(sh.Command('./autogen.sh'), _env=env)
Expand All @@ -42,7 +42,6 @@ def build_arch(self, arch: Arch) -> None:
_env=env
)

ensure_dir('install')
shprint(sh.make, 'install', _env=env)

def get_library_includes(self, arch: Arch) -> str:
Expand All @@ -52,7 +51,7 @@ def get_library_includes(self, arch: Arch) -> str:
variable `CPPFLAGS`.
"""
return " -I" + join(
self.get_build_dir(arch.arch), 'install', 'include',
self.get_build_dir(arch.arch), 'p4a_install', 'include',
)

def get_library_ldflags(self, arch: Arch) -> str:
Expand Down
Loading