aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside-tools/deploy_lib/android/buildozer.py
Commit message (Collapse)AuthorAgeFilesLines
* Use modern typing syntaxAdrian Herrmann2024-06-201-3/+2
| | | | | | | | | | | | We can already use the modern typing syntax introduced with Python 3.10 in 3.9 via future statement definitions, even before we raise the minimum Python version to 3.10. Note that direct expressions with "|" don't work yet. Task-number: PYSIDE-2786 Change-Id: Ie36c140fc960328322502ea29cf6868805a7c558 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Python-3.10: Allow the new syntax for Python 3.9Christian Tismer2024-06-201-0/+1
| | | | | | | | Add a future statement to all Python source files. Task-number: PYSIDE-2786 Change-Id: Icd6688c7795a9e16fdcaa829686d57792df27690 Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
* Android Deployment: Use develop branch of p4aShyamnath Premnadh2024-05-281-0/+7
| | | | | | | | | | | | - Temporary requirement since my latest changes are not yet merged into the master branch of p4a. This will be remove once the changes are in the master branch of p4a. Pick-to: 6.7 Task-number: PYSIDE-1612 Change-Id: I0e992b053de727660f4090779ee395e7a85451e6 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
* Deployment: RefactoringShyamnath Premnadh2024-02-291-217/+11
| | | | | | | | | | | | | | | | | | | | | | | | - Functions in buildozer.py for finding the local_libs, plugin and Qt module dependencies of the application are related to the overall config of the application and not buildozer. Hence, these functions are moved to android_config.py. - `ALL_PYSIDE_MODULES` moved to a function under deploy_lib/__init__.py and `platform_map` moved to deploy_lib/android/__init__.py. - Enable the user to pass both arm64-v8a and aarch64 as the architecture type. Same for all the other architecures that are synonymous. - `verify_and_set_recipe_dir()` is now called explicitly from android_deploy.py due to `cleanup()` deleting the recipe directories during config initialization. - New property `dependency_files` for AndroidConfig class. - Fix --dry-run for Android Deployment. - Adapt tests. Pick-to: 6.6 Task-number: PYSIDE-1612 Change-Id: Icdf14001ae2b07dc8614af3f458f9cad11eafdac Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* PySide Tools: Fix flake8 warningsShyamnath Premnadh2024-02-021-2/+2
| | | | | | | | | | | | - Fix general flake8 warnings in pyside-tools. - add F401 to .flake8 to ignore unused imports from __init__.py files - add E402 from __init__.py to prevent errors related to partial initialization of modules. Pick-to: 6.6 6.5 Change-Id: Ia848b08ff6f0d2808e04f6a83c46636e2d167c02 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Android Deployment: Remove personal fork of p4aShyamnath Premnadh2024-01-311-4/+0
| | | | | | | | | | | - Android deployment worked by using my own fork of p4a. This can be removed now that the changes are merged into the master branch of p4a. Pick-to: 6.6 Task-number: PYSIDE-1612 Change-Id: I530c6f6b6cbeffa80b3833c1d6efb50154eb47e9 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Android Deployment: Remove redundant updating of config fileShyamnath Premnadh2023-12-041-8/+0
| | | | | | | | | | - These can be removed since the update is done after initialization in android_deploy.py Task-number: PYSIDE-1612 Pick-to: 6.6 Change-Id: I7fa86e3c11a4161141a90ffd326c5748f149263d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Deployment: Add icon for applicationShyamnath Premnadh2023-12-041-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | - For Android deployment, by default kivy's icon is used when the application is deployed. This patch makes use of PySide icon as the default for all applications created with pyside6-android-deploy. - Icon formats accepted by Nutika windows: .ico macOS: .icns (contains a 128x128 .png file) linux: all standard image formats. We use .jpg - For Desktop deployment - change the option --linux-onefile-icon to --linux-icon. Both are the same. - Add icon options for macOS and Windows. - Adapt deployment test accordingly. - As an addition, add a default value to the --config-file option so that it picks up the one in the project directory automatically, if it exists. It aligns with the desktop deployment tool as per 6337e4a306babdb4015c248a14ad734b320ed2c1 - As another extra, remove an unused typing import from config.py Pick-to: 6.6 Task-number: PYSIDE-1612 Change-Id: Ia67ea96f94ddffe4bc65652f91c8b394c4e56a33 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Deployment: Code RefactoringShyamnath Premnadh2023-11-281-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | | - Move android related configurations into a new class AndroidConfig. This class inherits from the class Config. - Move configuration related code sections from `android_deploy.py` to `android_config.py` - get_config() renamed to create_config_file(). This simplifies a lot of code and makes Android deployment independent of Desktop deployment. - Move `generated_files_path` to `config.py`. As a result, `generated_files_path` does not need to be passed as parameter to to functions like `cleanup()`, `finalize()`, `Buildozer.initialize()` as config is already passed. - generated_files_path expression changed. This is because we assume the project_dir is always the parent of the source_file (i.e. main.py) - `Buildozer` import removed from `android/__init__.py` to prevent circular import issues. - Change buildozer commands to use "python -m" as prefix. Pick-to: 6.6 Task-number: PYSIDE-1612 Change-Id: Ie460dc459908dab44de82c3e269b806aff2c27c5 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Android Deployment: Filter module dependenciesShyamnath Premnadh2023-10-111-5/+14
| | | | | | | | | | | | | | | | | - An absolute 1:1 relation does not exist between Qt binaries and the generated PySide6 binaries eg: libQt6QmlModels.so exists and contains only QML types. Hence there are no Python bindings for it and QmlModels.abi3.so does not exist. - This patch cross checks the Qt module dependencies against available PySide6 modules and then decides if the dependency is a valid PySide6 module to be copied to the Android application `lib` folder and and also added to `libs.xml` to be loaded on application startup. - As an addition, 'isort' is ran on 'buildozer.py'. Pick-to: 6.6 Task-number: PYSIDE-1612 Change-Id: I40a6b747ee21a2eefadf557b81b5e1500b2d0a1e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Deployment: More code fixesShyamnath Premnadh2023-10-111-1/+1
| | | | | | | | | | | | | | | | | | | | | - Formatting and text updates. - extract_and_copy_jar() returns the extracted path to the jar directory - Buildozer class is now initialized when `pyside6-android-deploy` is run with --init. This is because it updates the recipes folder. - Buildozer defaults for Android NDK cannot be used anymore because `pyside6-android-deploy` uses llvm-readelf from the NDK to find the binary dependencies. - Change print statement to RuntimeError incase `main.py` does not exist - Change logging.exception to RuntimeError for the function `find_pyside_modules` Pick-to: 6.6 Task-number: PYSIDE-1612 Change-Id: I6ef5d5dfe9acae5f0029553ca2c6f07d91b6e462 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Android Deployment: copy required plugins to libsShyamnath Premnadh2023-10-021-9/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Copy the required Qt plugins from `site_packages` of the python bundled with the application to the `libs` folder of the Android gradle project. Android looks for required libraries in this `libs` folder. A similar step is also done by `androiddeployqt` when it created an Android gradle project from a C++ application. - Dependent Qt libraries found during processing of pyside6-android-deploy are also copied into the `libs` folder, if it does not exist already. - `plugins` key added to `pysidedeploy.spec`, which represents the plugins to be copied. - The Android dependency files shipped with Qt for Android platforms, are prased to obtain all the dependent Qt plugins of an application. - Some code refactoring to facilitate the plugin and library copy, by passing the plugin and library names to the PySide6 recipe template. `jinja2` does the job of using this template to create the PySide6 recipe to be used by python-for-android. - As an addition, fix some minor code issues and add extra logging. Task-number: PYSIDE-1612 Pick-to: 6.6 Change-Id: I63ca1e48aa1e4c98c912a87e68f3ae912ce89ca4 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Android Deployment: Add static_init_classesShyamnath Premnadh2023-09-211-7/+17
| | | | | | | | | | | | | | | - The `jar` xml element in the dependency files shipped with Qt for Android sometimes has a 'initClass' field which depicts the full qualified name of the class in the jar file. When available, this is to be added to libs.xml (used by Qt for Android to list the dependencies of the app) to identify the specific class being referenced. The element name for this in `libs.xml` is called `static_init_classes`. Task-number: PYSIDE-1612 Pick-to: 6.6 Change-Id: I184ea06e36054ebe70da5a81da48a732287016dc Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Android Deployment: Add .js filesShyamnath Premnadh2023-09-181-1/+1
| | | | | | | | | | - .js files in the application are now bundled with the app. Earlier, they were disregarded. Task-number: PYSIDE-1612 Pick-to: 6.6 6.5 Change-Id: Id81e5cdf7418549f10e1a0dfe8f944cf58664a86 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Android Deployment: find PySide and Qt dependenciesShyamnath Premnadh2023-09-081-20/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Use llvm-readelf to recursively find the dependencies of a dependent Qt binary. All the Qt dependencies are loaded at startup when loading the Android application. - Parse the revelant Python files of the project into ast, and find the used Python modules. Once the Python file is parsed into an ast, we find the imports of the following form: from PySide6 import Qt<module> from PySide6.Qt<module> import <classname> This is then used to identify the module used, and we try to load the binaries of this module. If the modules does not exist in Qt for Android, then an error is thrown. - The easiest way to find the relevant Python files in the project is using a .pyproject file which lists all the relevant files. If this is not there, then we find all the Python files in the project folder excluding the following folders: [".hg", ".svn", ".git", ".tox", "__pycache__", "env", "venv", "deployment",".buildozer"] - A new cli argument --extra-ignore-dirs, that lists the extra directories to ignore when searching for all the relevant python files in the project. - A new cli argument --extra-modules, that lists the extra modules to be added manually to the application incase they are not found by `pyside6-android-deploy` automatically. Adding a module using this argument means that the module binary is loaded by the Android application on startup. - sdk and ndk cli options are now mandatory to find the dependencies. These two options will be removed later when pyside6-android-deploy can automatically download them. Task-number: PYSIDE-1612 Change-Id: Ifbdc20cbc70ab0935a23157ccc8cb7fde6992df2 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Android Deployment - Add local libsShyamnath Premnadh2023-09-061-2/+42
| | | | | | | | | | | | | | | - local libs refer to those binary dependencies like plugins which might be required for a certain Qt module. This is normally listed in the xml dependency file for the module. One mandatory local lib dependency that every module has is the platform plugin named as libplugins_platforms_qtforandroid_x86_64.so for x86_64 and correspondingly for other platforms as well. - These libraries/plugins are called local_libs to align with libs.xml generated by androideployqt which calls them as local_libs. Task-number: PYSIDE-1612 Change-Id: I103d1691071936f191d867d8a20ddf8b019c38cb Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Android Deployment: Add only required Qt jarsShyamnath Premnadh2023-09-051-2/+34
| | | | | | | | | | | - Earlier all the jar files were bundled together with the app. This is now changed so that only the required jars, obtained from inspecting the dependent Qt module's xml dependency files are added. These files are included in the PySide Android wheel. Task-number: PYSIDE-1612 Change-Id: If1efb67a3a6f5815f14247e70a4c48a0b780585b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Android Deployment: Add App PermissionsShyamnath Premnadh2023-09-051-4/+55
| | | | | | | | | | | | | | | | | | | | | | - App runtime permissions are fetched from the corresponding Android dependency xml file based on the Qt modules used. * The Android wheels for PySide6 bundles these dependency files which are located in `lib`. * The dependency files also contain important information like the other dependent libraries, jars and plugins for each module. * The `zipfile` Python module is used to read the contents of these dependency xml files without extracting the PySide Android wheel. - The reference branch for python-for-android is changed from `pyside_support` to `pyside_support_2` to prevent failures in already released technical preview of pyside6-android-deploy. This will be changed when my patch for Qt support in python-for-android is merged. - Docstring is added to AndroidData class. Task-number: PYSIDE-1612 Change-Id: I63eb90e2f7f264e2f1d63af21cfd329eb7466e3f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Deployment: RefactoringShyamnath Premnadh2023-04-171-7/+7
| | | | | | | | | | | | - Fix --dry-run in Android deployment - Add option to control raising a warning when adding new entries to config file - Remove unnecessary code and comments Pick-to: 6.5 Task-number: PYSIDE-1612 Change-Id: I5975d76024d6289fe6b9af1caeca374acb81e8cc Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Deployment: New pyside6-android-deploy toolShyamnath Premnadh2023-03-311-0/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Preliminary support for PySide6 Android deployment - Uses jinja2 to create PySide6 and shiboken6 recipes, to be used by buildozer when python_for_android builds the app distribution - Classes for Buildozer config interaction - Run deployment to android. Typical command looks like: """ pyside6-android-deploy --wheel-pyside=./PySide6-6.5.0a1-6.5.0-cp37-abi3-android_x86_64.whl --wheel-shiboken=./shiboken6-6.5.0a1-6.5.0-cp37-abi3-android_x86_64.whl --name=stringlistmodel """ - New entrypoint for pyside6-android-deploy - Helper functinos for Android Deployment - Remove unused function main_py_exists() - Added the new files to deploy.pyproject - Remove dry_run argument from install_python_dependencies() - new Python packages added in requirements.txt to enable the deploy and cross compile tool Note: python-for-android uses my local fork. This will be changed once it is merged into python-for-android dev. Task-number: PYSIDE-1612 Pick-to: 6.5 Change-Id: I7eb96fa5507a476b4e86ec0195a5e9869f0f85fd Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* create pyside-tools2 with qt5 branchChristian Tismer2015-06-101-0/+0
|
* Remap examples and tools submodules from gitorious to githubRoman Lacko2013-08-011-0/+0
|
* Initial commit (copy of lck/pyside-dist repo)Roman Lacko2012-06-041-0/+0