Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a test app build to CI that uses Qt bootstrap
- for the purpose of testing, the pyside6 and shiboken6 wheels, the extra .jar files needed and the recipes for pyside6 and shiboken6 are manually added into testapps/on_device_unit_tests/test_qt. These files are normally generated by the `pyside6-android-deploy` tool that is shipped with PySide. Generating the wheels and the .jar files belongs to the scope of PySide and not python-for-android. Hence, they are not done here. This also reduces the load on the CI which will otherwise have to cross-compile CPython and PySide. - Only a minimal PySide with an essential non-ui module is added to the PySide6 wheel. This was mainly done to reduce the size of the wheel included into the python-for-android repository. - Tests were added in test_requirements.py so that when running the apk the current date and time are printed on the terminal.
- Loading branch information
Shyamnath Premnadh
authored and
Shyamnath Premnadh
committed
Dec 20, 2023
1 parent
b56bf17
commit 14dab2d
Showing
9 changed files
with
141 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file added
BIN
+23 KB
testapps/on_device_unit_tests/test_qt/jar/PySide6/jar/Qt6AndroidBindings.jar
Binary file not shown.
59 changes: 59 additions & 0 deletions
59
testapps/on_device_unit_tests/test_qt/recipes/PySide6/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Copyright (C) 2023 The Qt Company Ltd. | ||
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only | ||
|
||
import shutil | ||
import zipfile | ||
from os.path import join | ||
from pathlib import Path | ||
|
||
from pythonforandroid.logger import info | ||
from pythonforandroid.recipe import PythonRecipe | ||
|
||
|
||
class PySideRecipe(PythonRecipe): | ||
version = '6.6.0a1' | ||
url = "https://download.qt.io/snapshots/ci/pyside/test/Android/aarch64/PySide6-6.6.0a1-6.6.0-cp37-abi3-android_aarch64.whl" | ||
wheel_name = 'PySide6-6.6.0a1-6.6.0-cp37-abi3-android_aarch64.whl' | ||
depends = ["shiboken6"] | ||
call_hostpython_via_targetpython = False | ||
install_in_hostpython = False | ||
|
||
def build_arch(self, arch): | ||
"""Unzip the wheel and copy into site-packages of target""" | ||
|
||
self.wheel_path = join(self.ctx.packages_path, self.name, self.wheel_name) | ||
info("Copying libc++_shared.so from SDK to be loaded on startup") | ||
libcpp_path = f"{self.ctx.ndk.sysroot_lib_dir}/{arch.command_prefix}/libc++_shared.so" | ||
shutil.copyfile(libcpp_path, Path(self.ctx.get_libs_dir(arch.arch)) / "libc++_shared.so") | ||
|
||
info(f"Installing {self.name} into site-packages") | ||
with zipfile.ZipFile(self.wheel_path, "r") as zip_ref: | ||
info("Unzip wheels and copy into {}".format(self.ctx.get_python_install_dir(arch.arch))) | ||
zip_ref.extractall(self.ctx.get_python_install_dir(arch.arch)) | ||
|
||
lib_dir = Path(f"{self.ctx.get_python_install_dir(arch.arch)}/PySide6/Qt/lib") | ||
|
||
info("Copying Qt libraries to be loaded on startup") | ||
shutil.copytree(lib_dir, self.ctx.get_libs_dir(arch.arch), dirs_exist_ok=True) | ||
shutil.copyfile(lib_dir.parent.parent / "libpyside6.abi3.so", | ||
Path(self.ctx.get_libs_dir(arch.arch)) / "libpyside6.abi3.so") | ||
|
||
shutil.copyfile(lib_dir.parent.parent / "QtCore.abi3.so", | ||
Path(self.ctx.get_libs_dir(arch.arch)) / "QtCore.abi3.so") | ||
|
||
shutil.copyfile(lib_dir.parent.parent / "QtWidgets.abi3.so", | ||
Path(self.ctx.get_libs_dir(arch.arch)) / "QtWidgets.abi3.so") | ||
|
||
shutil.copyfile(lib_dir.parent.parent / "QtGui.abi3.so", | ||
Path(self.ctx.get_libs_dir(arch.arch)) / "QtGui.abi3.so") | ||
|
||
plugin_path = (lib_dir.parent / "plugins" / "platforms" / | ||
f"libplugins_platforms_qtforandroid_{arch.arch}.so") | ||
|
||
if plugin_path.exists(): | ||
shutil.copyfile(plugin_path, | ||
(Path(self.ctx.get_libs_dir(arch.arch)) / | ||
f"libplugins_platforms_qtforandroid_{arch.arch}.so")) | ||
|
||
|
||
recipe = PySideRecipe() |
35 changes: 35 additions & 0 deletions
35
testapps/on_device_unit_tests/test_qt/recipes/shiboken6/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Copyright (C) 2023 The Qt Company Ltd. | ||
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only | ||
|
||
import shutil | ||
import zipfile | ||
from os.path import join | ||
from pathlib import Path | ||
|
||
from pythonforandroid.logger import info | ||
from pythonforandroid.recipe import PythonRecipe | ||
|
||
|
||
class ShibokenRecipe(PythonRecipe): | ||
version = '6.6.0a1' | ||
url = "https://download.qt.io/snapshots/ci/pyside/test/Android/aarch64/shiboken6-6.6.0a1-6.6.0-cp37-abi3-android_aarch64.whl" | ||
wheel_name = 'shiboken6-6.6.0a1-6.6.0-cp37-abi3-android_aarch64.whl' | ||
|
||
call_hostpython_via_targetpython = False | ||
install_in_hostpython = False | ||
|
||
def build_arch(self, arch): | ||
''' Unzip the wheel and copy into site-packages of target''' | ||
|
||
self.wheel_path = join(self.ctx.packages_path, self.name, self.wheel_name) | ||
info('Installing {} into site-packages'.format(self.name)) | ||
with zipfile.ZipFile(self.wheel_path, 'r') as zip_ref: | ||
info('Unzip wheels and copy into {}'.format(self.ctx.get_python_install_dir(arch.arch))) | ||
zip_ref.extractall(self.ctx.get_python_install_dir(arch.arch)) | ||
|
||
lib_dir = Path(f"{self.ctx.get_python_install_dir(arch.arch)}/shiboken6") | ||
shutil.copyfile(lib_dir / "libshiboken6.abi3.so", | ||
Path(self.ctx.get_libs_dir(arch.arch)) / "libshiboken6.abi3.so") | ||
|
||
|
||
recipe = ShibokenRecipe() |