aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside-tools/deploy_lib
Commit message (Collapse)AuthorAgeFilesLines
* Deployment Docs: Add instructions to generate a bug reportShyamnath Premnadh3 days1-2/+0
| | | | | | | | | | - Additionally, remove some comments from default.spec that are not relevant anymore. Pick-to: 6.7 Task-number: PYSIDE-1612 Change-Id: Iea2fed95507b6e649285e409cf8678287bf15a56 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Desktop Deployment: Fix errorShyamnath Premnadh3 days1-7/+8
| | | | | | | | | | | | | | | In the scenario where 'pyside6-deploy --init' is used on the first run and for the consequent invocations, only running just 'pyside6-deploy' without any additional options, the deployment should have worked. This currently had a bug where it overrides the main Python entrypoint file with the default option of 'main.py'. This issue is caused due to the order of 'if' loop in the changed function. Pick-to: 6.7 Task-number: PYSIDE-1612 Change-Id: I605c4b9ff2035e85c0b5f73049a3ecc84d0fd80c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Android Deployment: Enable pyside6-android-deploy in macOSShyamnath Premnadh6 days2-2/+9
| | | | | | | | | | - enable the tool for macOS - add dependency .xml to the Android wheels Pick-to: 6.7 Task-number: PYSIDE-2766 Change-Id: I77495466b8a9cc3565c640beac202d533ee1d2a6 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Desktop Deployment: Update Nuitka to 2.3.2Shyamnath Premnadh9 days1-1/+1
| | | | | | | | | | - Full support for Python 3.12 - Experiemental support for Python 3.13 Pick-to: 6.7 Task-number: PYSIDE-1612 Change-Id: Ib4699351ec4105de756b4ac16cd7b3a49054a614 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Desktop Deployment: Enable Nuitka --standalone modeShyamnath Premnadh10 days4-9/+43
| | | | | | | | | | | | | - enables the standalone mode of Nuitka for pyside6-deploy - the mode can be set either through the command line or the config file - adapt tests - update documentation Pick-to: 6.7 Fixes: PYSIDE-2622 Task-number: PYSIDE-1612 Change-Id: I5a10c857d3e79174d2643139eb2e4f7b5e10d955 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@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>
* Desktop Deployment: ignore .qsb, .webp, .cpp.o and .qen filesShyamnath Premnadh2024-05-211-0/+14
| | | | | | | | | | | | | | | - These files have to be ignored in the deployment process because Nuitka is not able to recognize these file formats and considers them to the dlls instead of data files. - The missing .webp files breaks the usage of BusyIndicator type of QtQuick Controls. Hence, a bug report for that is raised in Nuitka : https://github.com/Nuitka/Nuitka/issues/2854 - Adapt tests Pick-to: 6.7 6.5 Change-Id: Ic4b3b6c65e059ec618a26361caa62b9d7c608690 Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Deployment: Adapt checking for plugin dependenciesShyamnath Premnadh2024-04-052-4/+14
| | | | | | | | | | | | | - Check if package e.g. PySide6_AddOns is installed before checking for the .json file - If a package is missing, add log warning for the missing package. If the .json file is missing inspite of the package being installed, then raise a proper warning. Pick-to: 6.7 6.7.0 Task-number: PYSIDE-1612 Change-Id: Ia65b06df15df7b334438f439762b135d9f61981d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Android Deployment: Update NDK version in the toolShyamnath Premnadh2024-03-131-1/+1
| | | | | | | | | - updated to r26b in accordance with Qt 6.7 Task-number: PYSIDE-1612 Change-Id: I7efa6d827b84d92a5571c4e2d337b6545810406a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
* Upgrade Nuitka to 2.1.0Shyamnath Premnadh2024-03-111-1/+1
| | | | | | | Task-number: PYSIDE-1612 Change-Id: Ieab3a7c7fd43e50e83c30d97cb70f6f1135b69e3 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
* Deployment: add permission support and create macOS bundle applicationShyamnath Premnadh2024-03-116-62/+200
| | | | | | | | | | | | | | | | | | - Look at the ast of the python files of the application to identify the permissions used by the application. Once the permissions are identified, pass the necessary NS property list key to be added to the Info.plist file to Nuitka. - For macOS, when deploying create a macOS application bundle (.app) by default. This makes it align more with Apple recommendations and Qt deployment. - Fix tests. - Fix wheel_tester.py to consider .app for macOS. Task-number: PYSIDE-1612 Task-number: PYSIDE-2468 Change-Id: Ie225c9a92c845b432a8e7eaa791a8aeb86ecd988 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Desktop Deployment: Optimize the plugins includedShyamnath Premnadh2024-03-074-29/+99
| | | | | | | | | | | | | | | | - Applications that use certain modules like Multimedia does not work because the plugins for it were not included. However, including all the plugins can make the application executable huge. This patch filters out the necessary plugins by looking at PySide6_Essentials.json and PySide6_Addons.json shipped with the wheels and only bundles these necessary plugins with the application. - Adjust tests. Task-number: PYSIDE-1612 Task-number: PYSIDE-2597 Change-Id: I35c74907a1782ae5101fb7c0861adcb97db5792d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Deployment: Find dependent modulesShyamnath Premnadh2024-03-066-142/+324
| | | | | | | | | | | | | | | | | | | | - Based on the desktop platform, find all the Qt module dependencies of the application just like Android. These dependencies can help in optimizing the plugins packaged with the application. - Desktop deployment has new cl arguments: --extra-ignore-dirs and --extra-modules that further complements finding the Qt modules used by the application. - Since the Qt dependencies are also required for desktop deployment, 'modules' field in pysidedeploy.spec is moved from under 'buildozer' key to 'qt' key. - dependency finding code moved to dependency_util.py. This also helps in list the imports without conflicts in deploy_lib/__init__.py. - Fix tests. Skip the deploy tests for macOS 11 as the CI does not include dyld_info either via XCode or CommandLineTools. Task-number: PYSIDE-1612 Change-Id: I3524e1996bfec76c5635d1b35ccbc4ecd6ba7b8d Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
* Deployment Config: Remove Nuitka dependenciesShyamnath Premnadh2024-03-011-1/+1
| | | | | | | | | | | | - ordered_set and zstandard are installed along with Nuitka. We don't need to explicitly specify them anymore. If they are not existing, it means that the user might have explicitly removed them. - Adapt tests. Pick-to: 6.6 Task-number: PYSIDE-1612 Change-Id: I21657cb6df95f2d33f48a719a71f49efab84990c Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Deployment: More Refactoring and minor bug fixesShyamnath Premnadh2024-03-015-194/+170
| | | | | | | | | | | | | | | | | | | | | | | | | | - setup_python() moved to constructor of PythonExecutable. -install_python_dependencies() moved under PythonExecutable in python_helper.py. - create_executable() of PythonExecutable removed. Instead, we call Nuitka.create_executable() directly. This removes unncessary import problems when using PythonExecutable class for Android Deployment. - nuitka==1.8.0 changed to Nuitka=1.8 in default.spec to match with the installed version. Otherwise, it forces the reinstall of Nuitka==1.8 every time (bug). - Remove recomputation of qt_plugins and local_libs. If the values exist in pysidedeploy.spec, then they should not be computed again. This serves the purposes of speeding up the deployment and also to no modifying the already existing pysidedeploy.spec. - find_pyside_modules() moved from python_helper.py to deploy_util.py. - Adapt tests. - Remove os.fspath wrapping from python.exe. This is not needed as python.exe is already pathlib.Path. Pick-to: 6.5 6.6 Task-number: PYSIDE-1612 Change-Id: Ic598e57cd2f2779c410b12fc9584cf60c5e94505 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Deployment: RefactoringShyamnath Premnadh2024-02-296-248/+270
| | | | | | | | | | | | | | | | | | | | | | | | - 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-028-27/+25
| | | | | | | | | | | | - 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: Explicit android group in config fileShyamnath Premnadh2024-01-312-8/+10
| | | | | | | | | | | | | - Distinguishes the changes fields as only relevant for Android Deployment. - This distinguishing group makes it clearer when we finally have iOS wheels. Pick-to: 6.6 Task-number: PYSIDE-1612 Change-Id: I215d2deec0117ae855e6d9a061642984eccd36ef Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Android Deployment: Install `buildozer` with --init cli argumentShyamnath Premnadh2023-12-081-1/+7
| | | | | | | | | | | | - When the --init option is used the config files are created, but to create buildozer.spec from pysideconfig.spec, buildozer has to be installed. This patch installs `buildozer` when --init option is passed. Task-number: PYSIDE-1612 Pick-to: 6.6 Change-Id: I6917496e509a0b4a203346145d1c3fe8dc73ba14 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-048-8/+50
| | | | | | | | | | | | | | | | | | | | | | | | | - 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>
* Upgrade Nuitka to 1.8.0Shyamnath Premnadh2023-12-041-2/+2
| | | | | | | | | | | | - No more warning on 3.11. Still no support for 3.12. - As a drive by, remove deployment related packages from the project's requirements.txt file. Pick-to: 6.6 6.5 Task-number: PYSIDE-1612 Change-Id: I1d379b4241d3e40de107ceb8c8d28b893de39dec Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Android Deployment: Add QtQuick dependency when presentShyamnath Premnadh2023-11-282-2/+17
| | | | | | | | | | | | | | | - Currently the dependencies are identified by checking the dependency files shipped with Qt and checking the Python files related to the project for PySide imports, to identify the Qt modules used. - This patch extends the dependency check by also checking the QML files related to the project for QtQuick and QtQuickControls2 import. Pick-to: 6.6 Task-number: PYSIDE-1612 Change-Id: Ia92ff9c2d06c383a6357b69f0f19160b1b522afa Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Deployment: Code RefactoringShyamnath Premnadh2023-11-287-231/+281
| | | | | | | | | | | | | | | | | | | | | | | | | - 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>
* Deployment: Relative path bug fixShyamnath Premnadh2023-11-231-2/+3
| | | | | | | | | | | | | | | | | | | | - The qml files are identified and stored as relative path and line under consideration tries to do a 'relative_to()' on an absolute path which causes the error ValueError: {qml_file} is not in the subpath of 'project_path' OR one path is relative and the other is absolute. The error only appears on the first run of pyside6-deploy with a project that does not have a .pyproject file. For the subsequent runs, absolute path are used because the path is fetched from the deploy config file. - This patch fixes this error by using absolute path for each qml_file Pick-to: 6.6 6.5 Task-number: PYSIDE-1612 Change-Id: Ib54edded404bd1be87ab5f22f61e2d30416b7dae Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* PySide build - remove importlib_metadataShyamnath Premnadh2023-11-091-6/+1
| | | | | | | | | Removed for 6.6 because we don't support Python 3.7 from PySide 6.6 Pick-to: 6.6 Change-Id: I2aea80ef28dad7bd346ff9f2321f01b3481e8762 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Deployment cleanup: isort and flake8Shyamnath Premnadh2023-10-2310-27/+30
| | | | | | | | Task-number: PYSIDE-1612 Pick-to: 6.6 Change-Id: I620582409749b1ce1e36721f1308005c4f6d2828 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> 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-114-17/+20
| | | | | | | | | | | | | | | | | | | | | - 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>
* Deployment tool: Code fixesShyamnath Premnadh2023-10-115-32/+51
| | | | | | | | | | | | | | | | | | | | | | | | | - `--config-file` now defaults to pysidedeploy.spec. This enables to automatically find the config file, in case if it is present, without specifying it through the `--config-file` option. - Use `pip freeze` also to check if a Python package in installed. This is useful for packages like `patchelf` which does not provide a Python module, but only an executable. - Change some `logging.exception()` to actual exceptions because the the exception requires some manual intervention for resolution. - Some of the config options were earlier reevaluated even when an existing config file exists. This is now adapted to skip the reevaluation when a config file exists. - In case of pyenv python, add `--static-libpython=no` as extra argument accepted by Nuitka. This is because pyenv Python uses `--enable-shared` by default since release 2.3.10 - https://github.com/pyenv/pyenv/pull/2554 - Some general fixes related to logging. Task-number: PYSIDE-1612 Pick-to: 6.6 Change-Id: Ib0fa0ca0ec3a08c07140c0c2fa32f422658d04d8 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Android Deployment: Identify Qt modules from generated Python filesShyamnath Premnadh2023-10-021-0/+26
| | | | | | | | | | | | | | | | | | | | | - This patch adds an extra step to check the existence of Python files generated from `pyside6-uic` and `pyside6-qrc` for identifying the imported Qt modules in the application. This only applies when the application has a .pyproject file. When the project does not have a .pyproject file, all the Python files in the application are checked for Qt module imports. The .pyproject file does not consider the generated Python files and hence the need of this patch. - For pyside6-deploy, this patch is irrelevant because Nuitka identifies all the required Python files of the project. Task-number: PYSIDE-1612 Pick-to: 6.6 Change-Id: Ic9a2812c42226b6baebab1b23fac8e410910578e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Android Deployment: copy required plugins to libsShyamnath Premnadh2023-10-026-28/+152
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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: auto download the required Android NDK and SDKShyamnath Premnadh2023-09-081-2/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | - Enable automatic download of Android NDK and SDK for creating Android PySide6 and shiboken6 wheels. Earlier, the user was required to manually download it and supply as a command line argument. - They are downloaded into the HOME directory of the user into the folder .pyside6_android_deploy. This is also similar to buildozer which downloads them into .buildozer. - The downloaded NDK is set to r25c, same as buildozer. The latest Android SDK packages are downloaded. - For the deployment tool, incase the NDK and SDK path are not provided either through the command line or through the configuration .spec file, the it will look for the NDK and SDK inside .pyside6_android_deploy, before falling back to the default Android NDK and SDK that buildozer supplies. buildozer will download them. - As a addition, a small code rearranging is also done, along with changing the deprecated subprocess.call() to subprocess.run(). Task-number: PYSIDE-1612 Change-Id: Ie8d51f8c7634b5b320b1dce2d4164985cbfbaaca Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Android Deployment: Load required PySide6 modules on startupShyamnath Premnadh2023-09-083-2/+21
| | | | | | | | | | | | | - This is required for having callbacks from C++/CPython back to Python. One example of this is when shiboken class="native" methods are called . There are also other cases where we call back to a Python callable through a callback from the wrapper code generated by Shiboken. - The identified Qt modules are loaded by the python-for-android recipe for PySide6. Task-number: PYSIDE-1612 Change-Id: I5881ac2351fc0afb87367b4149f0f668ac1a8d37 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Android Deployment: find PySide and Qt dependenciesShyamnath Premnadh2023-09-085-29/+224
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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-052-4/+58
| | | | | | | | | | | | | | | | | | | | | | - 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-174-28/+40
| | | | | | | | | | | | - 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>
* deploy: keep structure of qml filesCristián Maureira-Fredes2023-04-121-1/+5
| | | | | | | | | | | This avoids using the filename without a directory structure as destination directory when include them in the deployed application. Fixes: PYSIDE-2293 Pick-to: 6.5 Change-Id: I9515c6cb63d9008fa95d6749cd6e77d595b276fc Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Deployment: New pyside6-android-deploy toolShyamnath Premnadh2023-03-319-11/+426
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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>
* Deployment: Fix Nuitka Qml IssueShyamnath Premnadh2023-03-301-1/+1
| | | | | | | | | | | | | | | | | - Nuitka tries to do patchelf on all files in the 'Qt/qml' plugins folder. Although this is a Nuitka bug, the file qtquickcontrols2.conf that cause patchelf errors comes from the newly added MaterialEditor Qml plugin, which has no relevance to PySide6. Hence, removing it. - Some of the Qml issues were fixed by upgrading Nuitka to 1.5.4 - Adapt test Fixes: PYSIDE-2260 Task-number: PYSIDE-1612 Pick-to: 6.5 Change-Id: Ibc274769251e0533d960346a9d8271b2f65dcae9 Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Deployment: Change "desktop_packages" back to "packages"Shyamnath Premnadh2023-03-301-1/+1
| | | | | | | | | | - breaks source compatibility otherwise Task-number: PYSIDE-1612 Pick-to: 6.5 Change-Id: Ie0fd353872b7a93c94b650b09aa0fa53692e2455 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
* Deployment: Refactor to enable Android supportShyamnath Premnadh2023-03-295-37/+185
| | | | | | | | | | | | | | | | | | - moving code into functions so that Android can re-use them - new file "deploy_util.py" to store all the common utility functions that can be reused for Android deployment tool - new option "--name" to set the application name - Change some print statements to log statements - Adapt depoyment tests - In default.spec, rename "packages" to "desktop_packages" - Fix relative Qml file error in config.py i.e. it errors when the path is already relative Task-number: PYSIDE-1612 Pick-to: 6.5 Change-Id: Iaaea8837cc362b3cc8035b96247194c4a9679579 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Deployment: log string fixShyamnath Premnadh2023-03-281-4/+4
| | | | | | | | | | wrap the warning in quotes and remove '/' Task-number: PYSIDE-1612 Pick-to: 6.5 Change-Id: Idf49066c21bb73b48ca370ae32e962c195c19a49 Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Deployment Tool: Remove create_venv + fix --dry-run/--initShyamnath Premnadh2023-03-272-21/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | - As the deployment tool's code base grows larger, I realized that the ability to create a venv using pyside6-deploy was a bit of over engineering. There are instances where I have to use the current Python interpreter to fetch some information from the newly created venv Python, which results in weird code. Note: The tool would still work even if the user is using a globally installed Python interpreter with PySide6 installed. - Now, the user is warned if he is not in a virtual environment and prompted the requirement to install further Python packages. If the user input's "no", then the tool exits. - dry_run used to create an empty 'pysidedeploy.spec' which can wreck the normal deployment process. This is fixed by pyside6-deploy using the 'default.spec' instead of creating a new 'pysidedeploy.spec'. Fixes: PYSIDE-2258 Task-number: PYSIDE-1612 Pick-to: 6.4 6.5 Change-Id: I376d2a6aea9f93582eab7a904a81f48426bfee18 Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* importlib: Avoid installation of metadata moduleChristian Tismer2023-03-211-1/+4
| | | | | | | | | | | Since Python 3.8 there is a submodule for metadata, which makes a pip installation of import_metadata unnecessary. Task-number: PYSIDE-1564 Change-Id: I93ed8aa36e617f7c6c756cb6d750d858e983f82d Pick-to: 6.4 Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>