aboutsummaryrefslogtreecommitdiffstats
path: root/build_scripts/setup_runner.py
Commit message (Collapse)AuthorAgeFilesLines
* Remove deprecated command 'build_rst_docs'Dennis Oberst2024-04-121-1/+1
| | | | | | | | | | | ... has been removed in favor of 'build_base_docs'. [ChangeLog][PySide6] 'build_rst_docs' has been removed in favor of 'build_base_docs'. Fixes: PYSIDE-2504 Change-Id: I2abcd6d1cef8c6b6095c9f25500380adc748ab83 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* docs: deprecate 'build_rst_docs' in favor of 'build_base_docs'Dennis Oberst2023-10-261-1/+1
| | | | | | | | | | | | | | | | | | | The command for building documentation files has been renamed to 'build_base_docs' and the previous command, 'build_rst_docs', has been deprecated. All relevant occurrences of the command have been updated accordingly. In addition, the documentation config and build directory 'build/pyside6/doc/rst' has been renamed to 'build/pyside6/doc/base'. To ensure a fresh start when generating new documentation, the auto-generated `examples` and `html` directories are now deleted before generating new documentation. This change has been made because these directories are generated anyway, and starting fresh ensures that there are no conflicts or issues with the new documentation. Task-number: PYSIDE-2504 Change-Id: I395ad7e9482b0b68311820d58da362513ebb44b2 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* PySide Build: find qtpaths before SetupRunner.run_setup()Shyamnath Premnadh2023-02-081-9/+4
| | | | | | | | | | | | | | | | | | | | - 'qtpaths' needs to be known while setting up the corresponding setup.py command to ignore the pyside qt wrapper tools whose qt tool does not exist - This is an extension to 43109854a2966afe2e0cf29961157a6f54d5775c. The aforementioned patch led to qtpaths being found 2 times, once inside CommandMixin class and also much before that inside SetupRunner.run_setup(). This redundancy is now removed by moving the finding of OPTION['QTPATHS'] outside the mixin and before CommandMixin object of the command being run is initialized - the help commands, build_rst_docs and cross compilation command should not complain about qtpaths anymore - fixed cross compilation build Task-number: PYSIDE-2195 Change-Id: I862baf954dea0a3bdaf5ddf411f119178b457c42 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* build: introduce log levelCristián Maureira-Fredes2023-02-021-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | Removed the "quiet" and "verbose" older approach, and introduced a 3-level configuration so we can switch between them depending of the amount of output we need. By default, the log level is set to INFO, but it can be changed to VERBOSE and QUIET. The older "--verbose-build" and "--quiet" options were deprecated. The new way for setting the log level is: --log-level=quiet --log-level=verbose --log-level=info (default) The default option was made less verbose, controlling the output of the logging module, and cmake: for verbose it uses DEBUG, quiet uses ERROR, and no option uses INFO. Change-Id: Ida0289e3ea0ed09b7489a7513254137bba186fd0 Reviewed-by: Christian Tismer <tismer@stackless.com>
* build_scripts: remove unused importsCristián Maureira-Fredes2022-12-191-1/+0
| | | | | | | | | | Many leftovers from the pathlib migration patches. Pick-to: 6.4 Change-Id: I7126fadbe45dbb387bc8948ba777cb690f10a758 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* PySideTools: install tool only if corresponding Qt tool existsShyamnath Premnadh2022-11-161-2/+12
| | | | | | | | | | | | | | | | | | | | | | | - PySide tools which are wrappers around Qt tools are now only installed if the corresponding Qt tool exists. - PySide6 entry points for the Qt tool are now only created if the Qt tool exists in the corresponding Qt installation. - Incase the console entrypoint still exists and the corresponding Qt tool does not exist, the tool would exit stating that the Qt tool does not exist. eg: 'pyside6-uic' is run and 'uic' does not exist. The the tool outputs that the 'uic' does not exist. Ideally as per this change, PySide6 entrypoints for missing Qt tools should not exist at all. - versions.py deleted and contents moved to __init__.py. - Adds warning from Python incase if the tool does not exist. This is in addition to the CMake warning. Fixes: PYSIDE-2097 Pick-to: 6.4 6.2 Change-Id: I3f1b26d103679f7425d9ad85dfed8d9ad17f6fbf Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* pathlib: migrate build_scripts away from os.pathCristián Maureira-Fredes2022-10-181-1/+2
| | | | | | | | | 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: replace distutils.cmd.Command and sysconfigCristián Maureira-Fredes2022-10-131-1/+1
| | | | | | | | | | | | | 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/+3
| | | | | | | | | | 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: fix flake8 warnings and missing f-stringsCristián Maureira-Fredes2022-06-281-3/+3
| | | | | | Pick-to: 6.2 6.3 Change-Id: Ibd2a6088f6a2826be38a13037fe2db6656630b34 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-3/+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-1/+1
| | | | | | | | | | | - 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-11/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* setup.py: Prevent creation of byte-compiled filesChristian Tismer2021-12-201-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | Byte-compiled files (.pyc or .pyo) are generated by default when a module gets imported. The "setup install" command has additionally the effect of pre-compiling all Python files for the installation. This is much less relevant than when this behavior was implemented (was in Python 1.4, already in 1996). We don't want this behavior that clutters example directories and does not make much sense when the Limited API is used. The compiled files will still be created on import. But be aware of possible side effects because files may be written on a read-only installation. [ChangeLog][PySide6] The byte-compiling of example files is now suppressed to save space and clutter. Task-number: PYSIDE-1746 Change-Id: I811431030517c251f32bcadc4c98fb646b68eafa Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* setup.py: Fix no log messages being shown during setup callAlexandru Croitor2021-11-261-4/+12
| | | | | | | | | | | | | | | The default verbosity of a log object is WARN. distutils then set it to INFO when initializing the Distribution object. This would not affect the log object copy that setuptools exposes (and we now use). This caused the usual INFO messages not to be shown anymore. Explicitly set the setuptools log object verbosity to INFO unless the quiet option was given. Amends 95a5bb9dd3b5d3fa86f2ed0868e2b821256a6028 Pick-to: 6.2 Change-Id: I793dc92582007895fa23d43baabe5b97c146552e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Move from distutils to setuptoolsCristián Maureira-Fredes2021-11-261-1/+1
| | | | | | | | | | 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: Set log verbosity to INFOAlexandru Croitor2021-10-271-1/+4
| | | | | | | | | | | | So that the run_process commands in setup_runner.py actually print which setup.py sub-invocations are executed . Remove the duplicate log.info entries which are not needed anymore now that log verbosity is set correctly. Pick-to: 6.2 Change-Id: I8a07097b244c4d24ae53d0a9bb4c2e2896902308 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* build_scripts: use f-strings instead of format()Cristian Maureira-Fredes2021-01-041-11/+10
| | | | | | | Pick-to: 6.0 Change-Id: I165e9a39f968f67f9eae3a632739908d5f8fda59 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* setup.py: Pass --reuse-build only to commands that use DistUtilsCommandMixinDmitry Shachnev2020-12-091-1/+1
| | | | | | | | | | Other commands, such as configure, do not support it. Amends 0a00958b083008dea340ef78b0f235ca49b7d22c. Pick-to: 5.15 Change-Id: I5dbcea6aea60e027a8ff15d10351edbeaefdf338 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* setup.py: Fix 'clean' commandFriedemann Kleint2020-11-241-1/+6
| | | | | | | | | | | Do not add -reuse-build, which it cannot handle. Amends ff5a96c49e2aa5347c1c9892aad33c591e931639. Pick-to: 5.15 5.15.2 Task-number: PYSIDE-807 Change-Id: I96ab03b95dd7762b1a16f2acc5d8ca31555ef1a3 Reviewed-by: Alexander Volkov <avolkov@astralinux.ru> Reviewed-by: Christian Tismer <tismer@stackless.com>
* build scripts: Fix warning about import orderFriedemann Kleint2020-11-051-3/+1
| | | | | | | | | | Import Setuptools before Distutils, fixing: distutils_patch.py:25: UserWarning: Distutils was imported before Setuptools. This usage is discouraged and may exhibit undesirable behaviors or errors. Please use Setuptools' objects directly or at least import Setuptools first. Pick-to: 5.15 Change-Id: Ibbc1a5cd1d348f6f44f7e80a3ba7e9a7341fae8e Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Rename PySide2 to PySide6Friedemann Kleint2020-11-021-1/+1
| | | | | | | | Adapt CMake files, build scripts, tests and examples. Task-number: PYSIDE-904 Change-Id: I845f7b006e9ad274fed5444ec4c1f9dbe176ff88 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Rename shiboken2 to shiboken6Friedemann Kleint2020-10-281-1/+1
| | | | | | | | Adapt CMake files, build scripts, tests and examples. Task-number: PYSIDE-904 Change-Id: I4cb5ee4c8df539546014b08202a7b1e98ed3ff07 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* setup.py: Show options in command helpFriedemann Kleint2020-10-141-3/+5
| | | | | | | | | | | | Move some options to a command mixin. This cannot be done for all options since some determine the package name and need to be known at before instantiating the commands. Print an additional help text listing them. Fixes: PYSIDE-807 Change-Id: I43adb09db16f74af037bfb754cad2c0f5cfe43be Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* setup.py: Fix some flake8 warningsFriedemann Kleint2020-10-071-0/+1
| | | | | | | Fix spaces around operators, missing lines, import order. Change-Id: I05ecafec849578fed6018654fcefaa008b6801e8 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* setup.py: Do not display help multiple timesFriedemann Kleint2020-10-061-1/+5
| | | | | | | | Run only the pyside build when help is requested. Task-number: PYSIDE-807 Change-Id: I0aa5bf2db0a6a7e6e32a66357efd200af70dd653 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Clean the build/install output a bitCristián Maureira-Fredes2020-06-081-1/+5
| | | | | | | | | | | | * Adding STATUS or WARNING to a couple of message() calls. * Replacing some print() by log.info() * Changing some '*' by '-' * Align configuration outputs to check paths easily * Adding big message to check when shiboken2/pyside2 is being built. * Including the cmake_minimum_required() function instead of an 'if'. Change-Id: Idb6c5797286d400192d083403063e2ae582e3fe6 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Replace OPTION_* by a dictionaryCristián Maureira-Fredes2019-12-031-5/+4
| | | | | | | | | | | | Currently we are importing * from the options.py file, which is a problem for the linters to discover if we are properly using the options of the file. Having a dictionary provides also a better way of access these options, and it is more clean than having one variable per each option. Change-Id: Ie70bd88665357b85e2842c5df269857504ecccdf Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Improve code style with flake8Cristián Maureira-Fredes2019-11-251-1/+3
| | | | | | | | | | | | | | | | | - 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>
* setup.py: Fix running under non-UTF8 localeFriedemann Kleint2019-01-161-1/+1
| | | | | | | | | | Redirecting stderr to stdout causes an error when running under non-UTF8 locales. For the build scripts, it is also not desired to mix the output channels, so, remove the redirection. Change-Id: I6e3d05ede00537c3cc4c022780e8d0ed27bb0cad Fixes: PYSIDE-880 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Make quiet builds really quietAlexandru Croitor2018-12-071-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The change does a couple of things: - Sets the distutils / setuptools --verbose option to 0 - Sets the distutils / setuptools --quiet option to 1 - The options above end up calling distutils.log.set_verbosity(0) - Passes the QUIET_BUILD cmake option from setup.py to every CMake invocation, when --quiet is passed to setup.py - Sets the CMAKE_INSTALL_MESSAGE variable to silence messages regarding installation of files - Sets the CMAKE_RULE_MESSAGES variable to disable progress report in makefiles when building each source file - Overrides the CMake message function, not to display STATUS / info / untyped messages (still displays warnings and errors) - Changes the build / install elapsed time messages to always be printed even in quiet mode - Reverts the previously introduced set_quiet function in utils, because log.set_verbosity() now takes care of silencing those messages As a result, there's a lot less clutter when doing a quiet build. Warnings, errors and shiboken output is still displayed. Change-Id: Ie05c593ce7dc0aa04554c2d2859ce655233ddb9f Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Don't redirect stderr to stdout by default when calling setup.pyAlexandru Croitor2018-10-181-1/+1
| | | | | Change-Id: I49b7491be9649979f9f9487e983bdc4be355de07 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Allow building shiboken2 and PySide2 as separate wheelsAlexandru Croitor2018-10-121-0/+165
Actually this creates 3 wheel packages: - shiboken2 (the python module and libshiboken shared library) - shiboken2-generator (contains the generator executable, libclang and dependent Qt libraries) - PySide2 (the PySide2 modules and Qt shared libraries, and tools like rcc, uic) Calling the setup.py script will not do the actual build now (in the sense of calling CMake, make, etc.). Instead it will spawn new processes (via subprocess.call) calling the same setup.py script, but with different arguments. These "sub-invocations" will do the actual building. Thus, the "top-level invocation" will decide which packages to build and delegate that to the "sub-invocations" of setup.py. A new optional command line argument is introduced called "--build-type" which defaults to "all", and can also be set to "shiboken2", "shiboken2-generator" and "pyside2". A user can choose which packages to build using this option. The "top-level invocation" uses this option to decide how many "sub-invocations" to execute. A new command line argument called "--internal-build-type" takes the same values as the one above. It defines which package will actually be built in the new spawned "sub-invocation" process. The "top-level invocation" sets this automatically for each "sub-invocation" depending on the value of "--build-type". This option is also useful for developers that may want to debug the python building code in the "sub-invocation". Developers can set this manually via the command line, and thus avoid the process spawning indirection. A new class Config is introduced to facilitate storage of the various state needed for building a single package. A new class SetupRunner is introduced that takes care of the "--build-type" and "--internal-build-type" argument handling and delegation of "sub-invocations". A new class Options is introduced to 'hopefully', in the future, streamline the mess of option handling that we currently have. setup.py now is now simplified to mostly just call SetupRunner.run_setup(). Certain refactorings were done to facilitate further clean-up of the build code, the current code is definitely not the end all be all. Various other changes that were needed to implement the wheel separation: - a new cmake_helpers directory is added to share common cmake code between packages. - the custom popenasync.py file is removed in favor of using subprocess.call in as many places as possible, and thus avoid 10 different functions for process creation. - Manifest.in is removed, because copying to the setuptools build dir is now done directly by prepare_packages functions. - because prepare_packages copies directly to the setuptools build dir, avoiding the pyside_package dir, we do less copying of big Qt files now. - versioning of PySide2 and shiboken2 packages is now separate. shiboken2 and shiboken2-generator share the same versions for now though. - shiboken2 is now listed as a required package for PySide2, to facilitate pip requirements.txt dependencies. - coin_build_instructions currently needs to install an unreleased version of wheel, due to a bug that breaks installation of generated wheel files. - added separate command line options to pyside2_config.py for shiboken2-module and shiboken2-generator. - adapted samplebinding and scriptableapplication projects due to shiboken being a separate package. - adapted pyside2-tool and shiboken2-tool python scripts for setup tools entry points. - made some optimizations not to invoke cmake for shiboken2-generator when doing a top-level "all" build. - fixed unnecessary rpaths not to be included on Linux (mainly the Qt rpaths). Task-nubmer: PYSIDE-749 Change-Id: I0336043955624c1d12ed254802c442608cced5fb Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>