aboutsummaryrefslogtreecommitdiffstats
path: root/build_scripts/main.py
Commit message (Collapse)AuthorAgeFilesLines
...
* build: replace distutils.cmd.Command and sysconfigCristián Maureira-Fredes2022-10-131-3/+3
| | | | | | | | | | | | | Replaced various dsitutils leftovers: - distutils.cmd.Command by setuptools.Command - distutils.command.build by setuptools.command.build - distutils.sysconfig.get_python_lib(1) by sysconfig.get_paths()['platlib'] Task-number: PYSIDE-2079 Change-Id: Ia694629476f25019f4a9f8d3b306b0367a5cdb08 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* build: replace distutils.log by simple loggerCristián Maureira-Fredes2022-10-131-9/+9
| | | | | | | | | | Adding simple logger based on the logging module to replace the distutils.log one. Task-number: PYSIDE-2079 Change-Id: I2a4996a57be701552005b57d2b1a251b9fc44c41 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* build: replace DistutilsSetupError by SetupErrorCristián Maureira-Fredes2022-10-131-19/+19
| | | | | | | | Replacing the distutils errors by the setuptools one. Task-number: PYSIDE-2079 Change-Id: I9968d9562f8dd40317344d3295943c194e3f2197 Reviewed-by: Christian Tismer <tismer@stackless.com>
* build: remove local patchelfCristián Maureira-Fredes2022-10-131-6/+2
| | | | | | | | | | | | There is a package on PyPi that provides patchelf, so we can avoid to have an outdated copy locally and rely on people to install the package. Change-Id: If30046cda24bc31f38640f943f8ba0f65556232c Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* build system: Disable checking ICU libs for cross buildsFriedemann Kleint2022-09-261-1/+1
| | | | | | | | | | | ldd is used to determine the location of the ICU libs, which does not work for cross builds. Fixes: PYSIDE-2060 Pick-to: 6.3 Change-Id: Idbf8c6e9239f4623b7c11c646a616ef44e8c3ecf Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* doc: use more processes for sphinx-buildCristián Maureira-Fredes2022-09-011-1/+1
| | | | | | | | | | Adding the option '-j auto' to the calls we have for sphinx-build, speeding up the documentation generation process. Change-Id: Ie676d305e283fa217a90f3de64f96978ce6b3af0 Pick-to: 5.15 6.2 6.3 Task-number: PYSIDE-1106 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* build: use explicit unpackCristián Maureira-Fredes2022-06-291-4/+4
| | | | | | | | | Avoid accessing elements from sequences by index without being explicit about all the returns from functions. Pick-to: 6.2 6.3 Change-Id: I1cddda7f8c38724907cad854ee99489058dae5f3 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* build: replace the usage of reserved Python wordsCristián Maureira-Fredes2022-06-291-11/+11
| | | | | | | | | | Internally, we were using many words like 'filter', 'vars', and 'dir' which are built-in functions in Python. To avoid confusion and a possible wrong behavior, we renamed them. Pick-to: 6.2 6.3 Change-Id: Idbadda3857705ef3a5f0440112ee923d3a61ffa0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* build: rename our rmtree to avoid shutil conflictCristián Maureira-Fredes2022-06-291-5/+5
| | | | | | | | | | | There is an implementation in the 'utils' module that implements a 'rmtree' function to handle removing readonly files from a directory. To avoid confusion with shutil.rmtree we rename it to 'remove_tree'. Pick-to: 6.2 6.3 Change-Id: I3548ea81f36c87ba51fd984fcf7b1cd4cafd54d6 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* build: fix flake8 warnings and missing f-stringsCristián Maureira-Fredes2022-06-281-2/+3
| | | | | | Pick-to: 6.2 6.3 Change-Id: Ibd2a6088f6a2826be38a13037fe2db6656630b34 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* PyEnum: Use embedding of the Enum module for better execution speedChristian Tismer2022-06-161-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | The Enum module was optimized several times and is now in good shape. Old Python versions show massive slowdowns. Also, Python 3.6 does not support the functional API. As a general solution, we embed the current enum version to support older Python versions with the same module. Newer Python versions do a normal import. As a side effect, we have no longer to treat the old version Python 3.6 in any special way. This change is further necessary to be able to remove the old enum version, since Python 3.6 still exists in CI. NOTE: Python 3.6 and 3.7 had a hard-to-find refcount error when creating new enums. [ChangeLog][shiboken6] Python Enums use the newest implementation for Python (3.10) for compatibility and speed. Task-number: PYSIDE-1735 Change-Id: I1f105a6b0fb48e9364cb0654ccd9118d39f68542 Pick-to: 6.3 Reviewed-by: Christian Tismer <tismer@stackless.com>
* build: remove directories in 'package_for_wheels/' on re-runCristián Maureira-Fredes2022-06-011-13/+30
| | | | | | | | | | | | | | The 'package_for_wheels' directory remains populated on a second build, so to make sure that there are no conflicts, we remove the directories inside in case it exists. This means that 'shiboken6', 'shiboken6_generator', and 'pyside6' directories inside 'package_for_wheels' will be removed when found. Pick-to: 6.3 Change-Id: Idccbf1d2ab67e046e7d6288c8daa4e0a264ad08c Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Limited_API: Fix PyIndex_Check once and for allChristian Tismer2022-05-271-4/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PyIndex_Check was left as a macro for Python <= 3.7 . This was fixed for Python 3.8 (I failed to submit the patch in time :( ) The problem is a bit weird, because we cannot do a compile time decision which Python version it is, because exactly that is only known at runtime. Therefore: - we cannot use a builtin version of PyIndex_Check, because this would create a link error with Python < 3.8 - PyType_GetSlot would help with this, but unfortunately this worked only with heap types, and the use case is on normal integers. The solution is quite ok: ------------------------- The structure of the type objects from Python 3.6 on is compatible enough for the field offset that we need here, so on old Python versions, the old type structure can be used. From Python 3.10 on, PyType_GetSlot is extended to non-heap types, and we can simply use that. This patch can be removed completely when we drop Python 3.7 . An automated warning that suggests this removal was added. [ChangeLog][shiboken6] The handling of a complex Limited API bug was fixed for different combinations of PySide/Python versions. Change-Id: I945aa5ae1ea5cd9de7c6e140c32a1e9467735a8e Fixes: PYSIDE-1797 Pick-to: 6.2 6.3 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* flake8: fix style issues to build_scripts, amended: fix main.pyChristian Tismer2022-05-271-12/+14
| | | | | | | | | | | | | | | This cosmetic change caused plain Python builds without virtual env to break, again. The change was sorting the imports of main.py in some arbitrary way that caused problems. It would be much more convenient if changes to the setup scripts were tested with and without venv or virtualenv. These repeated errors are an annoying waste of time. Change-Id: I84335be874cc96128fa192a288a8a7909af13e99 Pick-to: 6.3 Fixes: PYSIDE-1760 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>
* Enable numpy support by defaultFriedemann Kleint2022-05-171-4/+19
| | | | | | | | | | | | | | | | | | | | | | This effectively undoes 36431b071095b8999347df87621bf23ffcc2ac3d which disabled numpy support in libpyside due to - break cx_freeeze - Cause embedding applications to fail to load with "undefined symbol: PyExc_RecursionError" Auto-detection along with --enable/--disable options is introduced instead. All numpy code is now located in libshiboken and it cleanly recovers when numpy cannot be found on the target system. The PyExc_RecursionError issue could not longer be reproduced. [ChangeLog][PySide6] Numpy support is now enabled by default. Task-number: PYSIDE-1924 Change-Id: I0fdb3612471971afa49ac3141845cf5d6dbfa7e0 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* build: copy instead of move the package directoryCristián Maureira-Fredes2022-04-221-2/+4
| | | | | | | | | | this had the effect that the 'setup.py install' command was failing to copy the built modules into the Python's site-packages. Pick-to: 6.3 6.3.0 Change-Id: Ifc5a94a43d68783a71efe29baa73f068a4c418a3 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* flake8: fix style issues to build_scripts/Cristián Maureira-Fredes2022-04-131-34/+30
| | | | | | Pick-to: 6.3 Change-Id: Ie56b054ca32869a488356b31eea49cc985fc463e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* PySide6: Optimize for SizeShyamnath Premnadh2022-04-111-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | build: use the following flag with setup.py to turn off size optimization --no-size-optimization Added the following compiler optimization flags and their corresponding flags on other platforms GCC - -ffunction-sections -fdata-section which segretates data and function section and linker flag --gc-section which removes unused code. - -fno-exceptions to disable exception handling - -Os - Optimize for size. Basically same as -O2 but removes some flags that cause increase in size. (Ran a couple of example and did not see difference in execution time) MSVC - /Gy /Gw /OPT:REF - same as -ffunction-sections, -fdata-section, -Wl, --gc-section - /EHsc same as -fno-exceptions - /O1 instead of /Os because for MSVC /O1 gave the best results. Clang - Same as GCC except for using -Oz instead of -Os. Experiments: Built a wheel with QtCore and noticed a 300kb reduction in size on both Windows and Linux. Built a complete wheel(except QTest) and it gives me a 4 mb size reduction with unaffected performance. Task-number: PYSIDE-1860 Change-Id: Ia5dfa2c4bfde92994c939b5fac0d0831fa3a73ab Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* doc: skip the documentation build by defaultCristián Maureira-Fredes2022-04-091-6/+13
| | | | | | | | | | | | | This reverse the current approach of building the documentation by default, and replace the skip-docs parameter by a build-docs one. A warning is printed when the --skip-docs is used, and another warning is displayed when using --doc-build-online without the --build-docs option. Change-Id: I2bf8302881b51e9831795a7e881b106022cdffa8 Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* build: script to create wheelsCristián Maureira-Fredes2022-03-291-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This approach intends to avoid modifying the current structure we have in build_scripts, and can replace the call: python setup.py bdist_wheel mainly encouraged by PEP517, and the need of having incremental wheels, to replace the current single PySide6 one. The current configuration allows to create two new wheels: PySide6_Essentials, and PySide6_Addons that contain all the essential and addons Qt modules defined by the Qt Installer tool, with some modifications due to the dependencies of certain tools. Check the README files for more info. The known PySide6 wheel is also generated, but it's empty in favor of using the previous two wheels as requirements, installing them automatically, to avoid modifying the usage of 'pip install pyside6' The strategy is based on the current logic behing 'prepare_packages' that we have been using. Once the modules are built, instead of removing those directories currently in 'build/your_env/package', we rename them. Inside this new directory, one can have the 'shiboken6', 'shiboken6_generator', and 'PySide6' directories, with eveything already packed with the required wheel structure. The main difference is that instead of using the content of PySide6 to build one build, we select some files with the MANIFEST.in to create another wheel. The wheel tag drops the old assumption of needing: cp36.cp37.cp38.cp39.cp310-abi3 and only uses: cp36-abi3 Additionally, for Linux, we follow PEP600 to use the GLIBC version in the wheel name instead of manylinux1, manylinux2010, etc... For the current CI configuration, we know we are using 2.28, which is the minimum supported version for Qt6, so the wheel will look like: PySide6-6.3.0-cp36-abi3-manylinux_2_28_x86_64.whl The coin scripts were configured as well, to add the call of the new create_wheels.py script, and test them via wheel_tester.py Note: This script is not intended to be used as a general purpose wheel creation tool, and it's purely focused on the current Qt CI. There are many ad-hoc configurations used in different functions, like the structure of a Qt installation, the usage of 'a' on the environment for limited-api, etc. Task-number: PYSIDE-1115 Fixes: PYSIDE-692 Change-Id: Ic12e428b8b9b64bbe2facb1c520595ccd2384497 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* flake8: improve codestyling of build scriptsCristián Maureira-Fredes2022-03-221-14/+12
| | | | | | | | | | | - 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>
* Strip libraries in release modeFriedemann Kleint2022-03-141-3/+6
| | | | | | | | | [ChangeLog][PySide6] Libraries are now stripped. Task-number: PYSIDE-661 Change-Id: I20ea056b8e91cca917017afa62811208c297d51d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* setup.py: Add support for cross-buildingAlexandru Croitor2022-02-041-19/+170
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* build_scripts: Avoid a racing condition in installChristian Tismer2022-01-051-0/+5
| | | | | | | | | | | | | | | | | | On macOS and a custom Python built, the "install" option crashes with an import error. This is a timing problem, because an import is triggered when it is already being processed. The problem is hidden by the use of virtualenv. [ChangeLog][PySide6] The move from distutils to setuptools caused a racing condition with certain Python builds. Change-Id: I4dcda2b083234e88c272a1794388f6d0e7b8f0e5 Pick-to: 6.2 Fixes: PYSIDE-1760 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Windows: Fix the build against complete LLVM packagesFriedemann Kleint2021-12-091-5/+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>
* Reland: Move all build dirs into a common 'build' subdirectoryAlexandru Croitor2021-12-071-18/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When building the project using setup.py, it would pollute the source directory with a lot of virtual environment build directories. Move all of those into a common 'build' subdirectory. This eases cleanup of all build directories because they can all be removed with a single rm command. It also places all the various stages of build -> install -> package folders into a common subdirectory so it's easier to find and navigate between them. If no virtualenv is detected, change the venv prefix from the previous value of 'pyside' to 'qfp' and include the build classifiers. If a virtualenv is detected, we consider it is distinct enough and don't include the build classifiers, apart from a few chars to denote a debug python, debug Qt or limited api build. Example of the new build directory structure when a virtualenv is detected build/{venv_name}/build/shiboken6 build/{venv_name}/build/pyside6 build/{venv_name}/install/bin/shiboken6 build/{venv_name}/package Example of the new build directory structure when a virtualenv is NOT detected build/qfp-py3.9-qt6.2.0-64bit-release/build/shiboken6 build/qfp-py3.9-qt6.2.0-64bit-release/build/pyside6 build/qfp-py3.9-qt6.2.0-64bit-release/install/bin/shiboken6 build/qfp-py3.9-qt6.2.0-64bit-release/package Move the code that always removed the ./build directory on each setup.py invocation into prepare_packages() instead. This way it only removes the files from the 'package' subfolder which is the common packaging location between all the sub-projects. This removal is needed to ensure shiboken files don't end up packaged in the PySide6 wheel. This relands commit 234349d124ccfa399921e2b9fc09addcff0b0a94 This reverts commit 0c6eb7cd232fff9d81a8d5bc9a7fd71d9b8c67f5 [ChangeLog][setup.py] Build directories are now created inside the root ./build directory, rather than directly under the root of the project. Pick-to: 6.2 Change-Id: I6d511ae77cb66c2c5a872d6b85ff33e1831b803e Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* setup.py: Make each setuptools command compute the same build dir infoAlexandru Croitor2021-12-071-170/+13
| | | | | | | | | | | | | | | | | | | ... as well as install dir, setuptools package dir and other common build path information we compute. This paves the way to reland 234349d124ccfa399921e2b9fc09addcff0b0a94 which was reverted in 0c6eb7cd232fff9d81a8d5bc9a7fd71d9b8c67f5 To do that, move the various build info computation into a separate mixin class that computes and assigns the values in PysideBuild.finalize_options() rather than run(). This ensures that PysideInstall and PysideBuildWheel inherit the same build dir / install dirs by querying the info from the build command. Pick-to: 6.2 Change-Id: I802f122ddf3eb1e9daff25fac4d697f2ceae8e0c Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* setup.py: Simplify logic of qmake and qtpaths lookupAlexandru Croitor2021-11-291-0/+1
| | | | | | | | | | | | | | | | | | 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: Don't add the Qt prefix dir to PATH env var before buildingAlexandru Croitor2021-11-261-5/+7
| | | | | | | | | | | | | | | | | | | | | Modifying PATH influences which packages are found by CMake's find_package, as well as which binaries are available to execute during the CMake build phase. Instead of relying on PATH, we should rely on passing the detected Qt prefix dir to CMAKE_PREFIX_PATH. This makes the build process more robust against differences in environment variables, as well as ensuring reproducibility when incrementally rebuilding a project manually without going through setup.py. Pick-to: 6.2 Task-number: PYSIDE-1033 Change-Id: I9c36d9924b82cb1133c44f4ef44ca785bbf7e862 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* setup.py: Add missing DistutilsSetupError importAlexandru Croitor2021-11-261-1/+1
| | | | | | | | | | DistutilsSetupError should be imported instead of DistutilsError. Amends 95a5bb9dd3b5d3fa86f2ed0868e2b821256a6028 Pick-to: 6.2 Change-Id: I9db9dd5114ef4413b57da2f60e3441071c122635 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Move from distutils to setuptoolsCristián Maureira-Fredes2021-11-261-38/+42
| | | | | | | | | | This is motivated by the deprecation of distutils, and removal in future versions https://github.com/pypa/packaging-problems/issues/127 Pick-to: 6.2 Change-Id: I16448b69f98df6dc1d9a904b69eb69ed5f1093f5 Reviewed-by: Christian Tismer <tismer@stackless.com>
* setup.py: Package QtWebEngine resources from Qt's data dirAlexandru Croitor2021-11-221-0/+1
| | | | | | | | | | | | 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: Remove dead function prepare_sub_modulesAlexandru Croitor2021-11-191-37/+0
| | | | | | | | | | | | | It was originally removed in the dev branch via 9c9b506f3b2cc64da6fbbef9f58ccec7ccfe4457 but was accidentally brought back with a 5.15 -> dev merge in 68ec9c643abf30cf22b9932ec82098cdebc08b98 Remove it again. Pick-to: 6.2 Change-Id: I86d3be455e45feeb5fd08cba49ca0324a6a1a26d Reviewed-by: Christian Tismer <tismer@stackless.com>
* Use legacy OpenGL option to build on linuxCristián Maureira-Fredes2021-11-181-0/+6
| | | | | | | | | Pick-to: 6.2 Fixes: PYSIDE-1547 Change-Id: I7ff4fe084c4121d5635479d5fd2ed9b6a9fa0df7 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* setup: coin: Use sccache when building if the platform config sets itAlexandru Croitor2021-11-151-0/+5
| | | | | | | | | | | | Set the CI_USE_SCCACHE env var if the sccache feature is enabled for the platform config. Pipe that through coin_build_instructions.py to setup.py. Add the relevant CMake cache vars so sccache is used. Pick-to: 6.2 Change-Id: I02d7ff0646791a5f0d2f1dd5c4a119ee016a9896 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Tismer <tismer@stackless.com>
* setup: Make ninja output the commands it runs in a verbose buildAlexandru Croitor2021-11-151-1/+6
| | | | | | | | | | | | | | Verbose build output worked when using the Makefiles generator because we set CMAKE_VERBOSE_MAKEFILE to ON, but that does not affect ninja. For ninja we need to explicitly pass -v on the command line. The verbose ninja output is useful when debugging build issues in the CI (which uses verbose build). Pick-to: 6.2 Change-Id: Ib1532db0225744184d89bf796c4b3a6a40d718ca Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Revert "setup.py: Move all build dirs into a common 'build' subdirectory"Alexandru Croitor2021-10-281-55/+21
| | | | | | | | | | | | | | | | | | | | | | This reverts commit 234349d124ccfa399921e2b9fc09addcff0b0a94. It fixes the following warning warning: PysideInstallLib: 'build/lib.macosx-10.14-x86_64-3.7' does not exist -- no Python modules to install The build_lib directory is only assigned during the run() method of the build command, which means the install command didn't pick up anything to install, because it expects the build_lib to be set during finalize_options of the build command, and it wasn't, it had the default value instead. Installation accidentally worked for the bdist_wheel command because the build command is run to completion before the install command is prepared. Pick-to: 6.2 Change-Id: I512a958db30858344f0d873a23bff0b925d7618e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* PyPySide: add it as a true new build targetChristian Tismer2021-10-281-0/+12
| | | | | | | | | | | | | | | | | | PyPy has now an appendix of its name and version at the end of the build path name. There are special settings needed in command.py to locate it in the folder structure. An extra check for PyPy has been added to the test script, because PyPy still has many errors. We use only one test run and extended timeouts until some crucial errors are gone. The blacklist file now understands pypy, pypy.7.3.6 etc. Task-number: PYSIDE-535 Change-Id: Ic2ab88bf35c5a18320733eb2552eca9e4315d04f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* setup.py: Move all build dirs into a common 'build' subdirectoryAlexandru Croitor2021-10-271-21/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When building the project using setup.py, it would pollute the source directory with a lot of virtual environment build directories Move all of those into a common 'build' subdirectory. This eases cleanup of all build directories because they can all be removed with a single rm command. It also places all the various stages of build -> install -> package folders into a common subdirectory so it's easier to find and navigate between them. Example of the new build directory structure build/py3venv/py3.7-qt6.2.0-64bit-release/build/shiboken6 build/py3venv/py3.7-qt6.2.0-64bit-release/build/pyside6 build/py3venv/py3.7-qt6.2.0-64bit-release/install/bin/shiboken6 build/py3venv/py3.7-qt6.2.0-64bit-release/package-lib.macosx-10.14-x86_64-3.7 The last 'package-xyz' subfolder will have its name shortened if the SHORTER_PATHS option is enabled, to avoid path limits on Windows. If no virtualenv is used, change the dir prefix from the previous 'pyside' one to 'qfp' because it's shorter and it's also less confusing that there are both shiboken and pyside subfolders inside 'qfp'. Move the code that always removed the ./build directory on each setup.py invocation into prepare_packages() instead. This way it only removes the files from the 'package' subfolder which is the common packaging location between all the sub-projects. This removal is needed to ensure shiboken files don't end up packaged in the PySide6 wheel. TODO: One more improvement would be to move the bdist_dir and bdist_wheel dirs into the same common subdirectory. This is a bit more complicated to do because it requires computation of the common subfolder and its dependencies in finalize_options of both the 'build' and 'bdist' stages. [ChangeLog][setup.py] Build directories are now created inside the root ./build directory, rather than directly under the root of the project. Pick-to: 6.2 Change-Id: Ie8c0dc27e5067acc9809b9cefaef6be66c76f9dd Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* setup.py: Fix QT_SRC_DIR to only be set if a path is set and it existsAlexandru Croitor2021-10-271-2/+5
| | | | | | | | | Fixes an issue when using a Qt that was not installed by the Qt online installer and thus doesn't have a Src subfolder. Pick-to: 6.2 Change-Id: Ide633e265a1768f88b39ab0b6b7306f1b890d087 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* build scripts: Fix broken packages (rpaths)Friedemann Kleint2021-07-061-10/+10
| | | | | | | | | | | | | | | | | The python modules were unable to find the Qt libraries after 401c8134dd84e3ad271c6a0a1e6248cf090d7fe4. This was since the update_rpath() appends the list of package libraries to the executables passed in and sets the rpath on them, too. This caused the libexec-rpath being set on them since the libexec executables were passed last. Disentangle this by splitting out a helper to find the package libraries and call update_rpath() separately for them. Amends 401c8134dd84e3ad271c6a0a1e6248cf090d7fe4. Change-Id: I8d647d4e9b1e24e1d6dbc87801bcb4e5fccaf88e Reviewed-by: Christian Tismer <tismer@stackless.com>
* Pyside6/Qt Designer: Fix Python code preview not working on UNIXFriedemann Kleint2021-07-061-3/+6
| | | | | | | | | | | | | | | | | | | | | | Qt Designer as bundled by PySide6 was unable to find the uic binary in the libexec directory of the bundled Qt since that was only copied when QtWebEngine was built and the rcc/uic binaries were copied into the main directory. Also, libexec existed as a file containing qt.conf, which was created by a copy statement not checking for the target directory. Fix that by actually creating a libexec directory for uic, rcc and QtWebEngineProcess. Patch the executables accordingly. Add checks before copying qt.conf. Adapt pyside-tool to use libexec. The Windows code path remains the same, everything uses main directory there. Change-Id: I0c9f46fb776ed0315eecb6ed00202ea8d8f17fe2 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Tismer <tismer@stackless.com>
* build_scripts: Pass --quiet to build_rst_docsFriedemann Kleint2021-06-241-0/+2
| | | | | | | | | Otherwise, the log messages from the example gallery clutter the sphinx warnings from the shiboken manual. Pick-to: 6.1 Change-Id: I1a8e3b685a4bfb830baea3a2221fc7980fee24e1 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Introduce qtpaths as qmake replacementFriedemann Kleint2021-06-171-1/+3
| | | | | | | | | | | | | | 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>
* Fix cmake argument for standalone macOSCristian Maureira-Fredes2021-05-061-1/+1
| | | | | | | | | | | | | | The command --build doesn't properly work when trying to do a standalone invocation, and complains that it's an unknown argument, since that's meant to invoke a build with ninja, make, etc, and not to get information related the path of libraries, -B should be used instead. Fixes: PYSIDE-1556 Pick-to: 6.1 6.1.0 Change-Id: I4e64477032beba75c1210cb29093465f1c85bb6c Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Turn off numpy support in libpyside by defaultFriedemann Kleint2021-05-051-0/+3
| | | | | | | | | | | | | | Add a configure parameter for it and mark it as experimental. It has been found to: - break cx_freeeze - Cause embedding applications to fail to load with "undefined symbol: PyExc_RecursionError" Pick-to: 6.1 6.1.0 Task-number: PYSIDE-1540 Task-number: PYSIDE-1503 Task-number: PYSIDE-1455 Change-Id: I72fa4a3324a37eb996c42b83dce55fe1990b6fc3 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Build system: Make numpy centrally availableFriedemann Kleint2021-04-211-1/+5
| | | | | | | | | | | In order to be able to use numpy in PySide6 modules besides libshiboken, move the numpy detection into the build scripts and pass it as a CMake variable. Task-number: PYSIDE-1540 Task-number: PYSIDE-1503 Change-Id: Ib30fdbab83904878286b7eaae1674ffba0f2febd Reviewed-by: Christian Tismer <tismer@stackless.com>
* Enable shiboken documentation build for macOS againChristian Tismer2021-04-111-0/+7
| | | | | | | | | | | | | | | | | | Python v3.6 and docutils v0.17 have an encoding problem, because the default encoding is ASCII. That produces an encoding error on macOS in Sphinx: Running Sphinx v3.5.3 Encoding error: 'ascii' codec can't decode byte 0xc2 in position 69: ordinal not in range(128) The problem happens on macOS because CI uses that old version. It can be avoided by setting UTF-8 encoding. Change-Id: I88ee27cfb529dfec291dc079bcc2d52f656f180f Pick-to: 5.15 Pick-to: 6.0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* doc: make sure '--skip-docs' skip the docsCristian Maureira-Fredes2021-04-061-8/+14
| | | | | | | | | | | | | Even when using the code, some portions of the cmake file in sources/pyside6/doc/ was still being executed. This makes sure everything is skipped if we use the '--skip-docs' option when building. Pick-to: 6.0 5.15 Change-Id: If78b19b9650b61b642e447b8c96b814e82994d7c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>