aboutsummaryrefslogtreecommitdiffstats
path: root/build_scripts/qtinfo.py
Commit message (Collapse)AuthorAgeFilesLines
* Remove unnecessary use of 'object' in class constructionremoteobjectsdevCristián Maureira-Fredes2024-12-181-1/+1
| | | | | | | | | | | Considering we are not compatible with Python 2 anymore, we can drop the 'object' explicit inheritance in the class declaration. Pick-to: 6.8 Change-Id: Iac3a95aa9721c3ff1a755f457c0936ca157a8470 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* build: improve the build configuration implementationCristián Maureira-Fredes2024-12-181-1/+1
| | | | | | | | | | | | - Using Singleton for the class - Adding type hints for the Path variables - Use function for parsing modules instead of duplicating it - Adapting related code in other files as well - Remove historical prints when configuring. Pick-to: 6.8 Change-Id: I9fef2e8d7c2033442f89a6f6ca027b5ae2ac6ab4 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* 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>
* Build scripts: Fix "modules" directory for Qt builds with --archdata-dirFriedemann Kleint2023-09-131-2/+2
| | | | | | | | | | | "modules" is relative to arch data. Fixes: PYSIDE-2461 Task-number: QTBUG-116983 Pick-to: 6.5 Change-Id: Ibb91934cc13c164cbba208989e8583248a69115f Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Copy Qt module JSON files for usage by create_wheels.pyFriedemann Kleint2023-04-171-0/+6
| | | | | | Pick-to: 6.5 Change-Id: I147609680589019c6db9dc13add64bf3e0dbab94 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* Build scripts: Adapt to changed location of the metatypes directory in QtFriedemann Kleint2022-12-021-0/+13
| | | | | | | | | | | metatypes are now located under arch_data after qtbase/4234ce12dc819b9ca76c8dc4c251f5bd4fe0bc9c. Allow for a smooth transition by adding a version check. Change-Id: I15e4d560d4a93c7d2e6f737f6f303fcc0c6a678b Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* pathlib: migrate build_scripts away from os.pathCristián Maureira-Fredes2022-10-181-1/+1
| | | | | | | | | There is a usage of os.path.relpath that cannot be migrated to pathlib, which remain the only usage of os.path Task-number: PYSIDE-2080 Change-Id: Iac781e9c9324fb8b9d3559b4225912d56782072a Reviewed-by: Christian Tismer <tismer@stackless.com>
* build: avoid mutable default value as argumentCristián Maureira-Fredes2022-06-281-2/+6
| | | | | | | | | | Mainly to avoid having a persistent object every time we call the function, to avoid future issues. Pick-to: 6.2 6.3 Change-Id: I9aea45ffa7ecd381e8c5ed6b3c83036d6e8aef72 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-271-38/+2
| | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: I065150015bdb84a3096b5b39c061cf0a20ab637d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* flake8: fix style issues to build_scripts/Cristián Maureira-Fredes2022-04-131-2/+3
| | | | | | Pick-to: 6.3 Change-Id: Ie56b054ca32869a488356b31eea49cc985fc463e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* flake8: improve codestyling of build scriptsCristián Maureira-Fredes2022-03-221-4/+0
| | | | | | | | | | | - Fixing f-strings - Fixing indentation of some lines - Removing unused variables and imports - Changing the way of verifying if sphinx is installed Change-Id: I3f361759682324c9b0c9d33c24583435f137f05a Pick-to: 6.2 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* setup.py: Add support for cross-buildingAlexandru Croitor2022-02-041-71/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | setup.py can now be used to cross-compile PySide to a target Linux distribution from a Linux host. For example you could cross-compile PySide targeting an arm64 Raspberry Pi4 sysroot on an Ubuntu x86_64 host machine. Cross-compiling PySide has a few requirements: - a sysroot to cross-compile against, with a pre-installed Qt, Python interpreter, library and development packages (which provides C++ headers) - a host Qt installation of the same version that is in the target sysroot - a host Python installation, preferably of the same version as the target one (to run setup.py) - a working cross-compiling toolchain (cross-compiler, linker, etc) - a custom written CMake toolchain file - CMake version 3.17+ - Qt version 6.3+ The CMake toolchain file is required to set up all the relevant cross-compilation information: where the sysroot is, where the toolchain is, the compiler name, compiler flags, etc. Once are requirements are met, to cross-compile one has to specify a few additional options when calling setup.py: the path to the cmake toolchain file, the path to the host Qt installation and the target python platform name. An example setup.py invocation to build a wheel for an armv7 machine might look like the following: python setup.py bdist_wheel --parallel=8 --ignore-git --reuse-build --cmake-toolchain-file=$PWD/rpi/toolchain_armv7.cmake --qt-host-path=/opt/Qt/6.3.0/gcc_64 --plat-name=linux_armv7l --limited-api=yes --standalone Sample platform names that can be used are: linux_armv7, linux_aarch64. If the auto-detection code fails to find the target Python or Qt installation, one can specify their location by providing the --python-target-path=<path> and --qt-target-path=<path> options to setup.py. If the automatic build of the host shiboken code generator fails, one can specify the path to a custom built host shiboken via the --shiboken-host-path option. Documentation about the build process and a sample CMake toolchain file will be added in a separate change. Implementation details. Internally, setup.py will build a host shiboken executable using the provided host Qt path, and then use it for the cross-build. This is achieved via an extra setup.py sub-invocation with some heuristics on which options should be passed to the sub-invocation. The host shiboken is not included in the target wheels. Introspection of where the host / target Qt and Python are located is done via CMake compile tests, because we can't query information from a qmake that is built for a different architecture / platform. When limited API is enabled, we modify the wheel name to contain the manylinux2014 tag, despite the wheel not fully qualifying for that tag. When copying the Qt libraries / plugins from the target sysroot in a standalone build, we need to adjust all their rpaths to match the destination directory layout of the wheel. Fixes: PYSIDE-802 Task-number: PYSIDE-1033 Change-Id: I6e8c51ef5127d85949de650396d615ca95194db0 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Windows: Fix the build against complete LLVM packagesFriedemann Kleint2021-12-091-0/+3
| | | | | | | | | | When compiling a dummy project for determining config values, CMake is fooled to use clang++ as a compiler if it finds it. Force it to use MSVC as is done for the build. Pick-to: 6.2 Change-Id: Ic1031a9aa078c0d05adf6495b4db665a0813e3f9 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* setup.py: Simplify logic of qmake and qtpaths lookupAlexandru Croitor2021-11-291-0/+4
| | | | | | | | | | | | | | | | | | If an explicit qmake or qtpaths option is given, use it to determine the Qt prefix dir. If no option is specified, try to find qtpaths in PATH. Don't try to find the sibling tool as we did before this change, there's no benefit in doing that. Either one can be used to query the required Qt information. Make sure to log both tool paths. Amends 3b4764fefbb349eafb831b5da90f565b34c77a52 Pick-to: 6.2 Change-Id: I03afaa8d8476b3d09affdde28f3ff6f1fdf652b6 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* setup.py: Package QtWebEngine resources from Qt's data dirAlexandru Croitor2021-11-221-0/+4
| | | | | | | | | | | | The QtWebEngine resources are not necessarily in $qt_prefix/resources. On Linux, distro's might specify a different value for QT_INSTALL_DATA. Make sure to use that value. Pick-to: 6.2 Change-Id: I5bed723de07d39d0bc72e7932161809150433037 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* setup.py: Reduce cmake_minimum_required to 3.16Alexandru Croitor2021-10-271-1/+1
| | | | | | | | | | | All the CMake projects require CMake 3.16, only the setup.py 'mkspecs extraction' project required 3.18 for some reason. Lower it to 3.16 as well. This is inline with the minimum CMake version needed for build Qt. Pick-to: 6.2 Change-Id: I6b2d39c726ff2b8077d71c990a4ee8e363e2a163 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* setup.py: Allow specifying Qt without adding it to PATHAlexandru Croitor2021-10-271-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Fix setup.py to allow specifying Qt either via --qtpaths or --qmake options. Previously if only one of the options were provided, the build would fail saying that the other option was not provided. Instead, only fail if neither options were provided. Reconstruct the path to the missing tool based on the path of the one that was provided. Prefer qtpaths, because the qmake option is deprecated. Even if both --qtpaths and --qmake options were provided to setup.py, the build would still fail when running _get_cmake_mkspecs_variables because it couldn't find a Qt package. The CMake project that is configured in that function depended on PATH being set to Qt's prefix, which CMake's find_package would then pick up. Explicitly pass the Qt prefix via CMAKE_PREFIX_PATH when configuring the project. Pick-to: 6.2 Change-Id: Ibd0cb35f8902e3d795c308c9c755a342118b0848 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* build scripts: Fix qmake messageFriedemann Kleint2021-06-171-4/+1
| | | | | | | | | | The qmake variable was changed to a string by 579372b8d45f847ddaae14b361b9d8ca54c044f3. Task-number: QTBUG-75870 Pick-to: 6.1 Change-Id: Idec1e9062fdbe474429885d70f36eb3accca0193 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Introduce qtpaths as qmake replacementFriedemann Kleint2021-06-171-3/+26
| | | | | | | | | | | | | | qtpaths has become the recommended tool for querying Qt properties (see qtbase/fef850c51a069ed89ba400e6ffccbbea4b0cbb9f). Deprecate the --qmake option in favor of it and use qtpaths for the values. qmake is only used if a path is given on the command line. [ChangeLog][PySide6] qtpaths is now used to query Qt properties. Task-number: QTBUG-75870 Change-Id: I9a29b05d8b6e982647eeeeeda0134ddc807da141 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* build scripts: Replace qmake mkspec parsing by cmakeFriedemann Kleint2021-06-171-59/+62
| | | | | | | | | | Determine build type and macOS target by creating a cmake dummy project instead of a qmake one. Task-number: QTBUG-75870 Change-Id: Ia25124e42dd10bf503f7e613b0edcec88a005633 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* build scripts: Remove qtchooser handlingFriedemann Kleint2021-06-161-19/+4
| | | | | | | | | qtchooser does not exist in Qt 6. Change _qmake_command to a string. Task-number: QTBUG-75870 Pick-to: 6.1 Change-Id: I6eb69fbd839567ba0e67c9d792666662126494cc Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* setup.py/Windows: Fix warning about file accessFriedemann Kleint2021-05-311-13/+17
| | | | | | | | | | | | Having the temporary file open while qmake runs causes an access error on Windows. To fix this, create the file in a temporary directory, where also the stash file goes. Pick-to: 6.1 Change-Id: I3e972bbf29f68ec5d22d993488fc88b8b5c0a5a6 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* build_scripts: clean and format qtinfoCristian Maureira-Fredes2021-05-041-86/+81
| | | | | | | | | | | * Use @property directly instead of the old notation * Move Singleton machinery to the top of the class * Use the tempfile module * Use double quotes instead of single ones Change-Id: I9ee81cf6c13314c4179092e2e6feb0871363abb2 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* build_scripts: use f-strings instead of format()Cristian Maureira-Fredes2021-01-041-2/+2
| | | | | | | Pick-to: 6.0 Change-Id: I165e9a39f968f67f9eae3a632739908d5f8fda59 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* build_scripts: remove references to python 2Cristian Maureira-Fredes2020-10-271-4/+1
| | | | | | | | | * Removing all the special cases for Python 2.7 * Removing Python >=3 conditions * Keeping Python 3.6+ as the allowed Python Change-Id: Ie48cafe952ae7a11bea997da2a35e7df5fea9a44 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* setup.py: Fix some flake8 warningsFriedemann Kleint2020-10-071-1/+1
| | | | | | | Fix spaces around operators, missing lines, import order. Change-Id: I05ecafec849578fed6018654fcefaa008b6801e8 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* setup.py: Make it possible to access QtInfo from several sourcesFriedemann Kleint2020-10-061-185/+206
| | | | | | | | | | - Turn it into a singleton. - Move the qtchooser resolving code into QtInfo. - Delay-initialize the dictionary. Task-number: PYSIDE-807 Change-Id: I3be2f3d0e0e9bc8aa61e1ec90ea37f7078c7f0bb Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Fix qtinfo on macOS when XCode is newly installedChristian Tismer2020-02-201-1/+1
| | | | | | | | | | | | | | I happened to try out the "cling" C++ interpreter. That forced me to install XCode. I did not run XCode because cling worked immediately. But then, building PySide always failed with an error in qtinfo. This is a rare trap into which I fall every other year, so here is a fix that returns the intended error message. Change-Id: I9ec5774c49b8a186d6b4247150dac6b252e7cc64 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Improve code style with flake8Cristián Maureira-Fredes2019-11-251-4/+8
| | | | | | | | | | | | | | | | | - We agreed on 100 columns time ago, so I move around a few things, - Removing unused modules, - Fix white-spaces tabs without being multiple of 4, - Encourage the use of os.path.join when joining paths, - Using .format() for string formatting, - Remove white-spaces from default arguments, - Adjusting white-spaces before inline comments, - Adding extra newlines when expected, - Adjust spaces for lines under-indented for visual indent, - Remove white-spaces from parenthesis, and adding them for arithmetic operators. Change-Id: I9cb28cefd114d63580b584a063c452f90d3ca885 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Format python files to use PEP8Cristian Maureira-Fredes2018-05-231-64/+64
| | | | | | | Change-Id: I8dc16c10565da8f93ba5cb7cace004f8eaf52236 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* Change license from all the filesCristian Maureira-Fredes2018-05-031-1/+1
| | | | | | | | | | | | | | | | | Removing the word 'project' from all the headers, and changing the PySide reference from the examples to Qt for Python: The following line was used inside the source/ and build_scripts/ directory: for i in $(grep -r "the Qt for Python project" * |grep -v "pyside2-tools" | awk '{print $1}' | sed 's/:.*//g');do sed -i 's/the\ Qt\ for\ Python\ project/Qt\ for\ Python/g' $i;done and the following line was used inside the examples/ directory: for i in $(grep -r "of the PySide" * |grep -v "pyside2-tools" | awk '{print $1}' | sed 's/:.*//g');do sed -i 's/of\ the\ PySide/of\ the\ Qt\ for\ Python/g' $i;done Change-Id: Ic480714686ad62ac4d81c670f87f1c2033d4ffa1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Split and move various setup.py parts into different filesAlexandru Croitor2018-04-301-0/+237
This is an initial effort to clean up setup.py. A new directory called build_scripts contains most of the logic for building, leaving setup.py as an entry point. The build_scripts directory contains the usual qtinfo, utils, and the setup.py content has been split into main.py and platform specific files under platforms subfolder. The testrunner script has been modified to find the new location of the utils module. Task-number: PYSIDE-558 Change-Id: I3e041d5116ca5c3f96c789317303b65a7b1bbd70 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>