pyqtbuild
Module Reference¶
The pyqtbuild
module implements the PyQt build system. This is an
extension of the SIP build system implemented by the sipbuild
module.
To install it, together with the pyqt-bundle program, from PyPI,
run:
pip install PyQt-builder
If you are developing a set of bindings based on PyQt then you should place the
following line in the [build-system]
section of your pyproject.toml
file:
requires = ["PyQt-builder >=1, <2"]
This will ensure that PyQt-builder
is automatically installed if a user
uses pip to install your project.
PyQtBindings
¶
-
class
pyqtbuild.
PyQtBindings
(project, name, **kwargs)¶ A
Bindings
sub-class that configures aQmakeBuilder
builder and supports the use of test programs to determine if a set of bindings are buildable and how they should be configured.Test programs are either internal or external. An internal test is constructed from the
test-headers
andtest-statement
keys described below and is compiled (but not executed) to determine if the bindings are buildable.An external test is a self contained C++ source file with the same name as the bindings with a
cfgtest_
prefix and a.cpp
extension. The source file is compiled and executed and it’s output analysed to determine if the bindings are buildable.PyQtBindings
adds the following keys to each[tool.sip.bindings]
section ofpyproject.toml
:- qmake-CONFIG
The value is a list of modifications to make to the
CONFIG
value in all generated.pro
files. An element may start with-
to specify that the value should be removed.- qmake-QT
The value is a list of modifications to make to the
QT
value in all generated.pro
files. An element may start with-
to specify that the value should be removed.- test-headers
The value is a list of
.h
header files to include in any internal test program.- test-statement
The value is a C++ statement that will be included in any internal test program.
- Parameters
project (Project) – is the project.
name (str) – is the name of the bindings.
**kwargs – are keyword arguments that define the initial values of any corresponding
Option
defined by the bindings. AnOption
value set in this way cannot be overridden in thepyproject.toml
file or by using a tool command line option.
-
handle_test_output
(test_output)¶ Called by the bindings to handle the output from an external test program and to determine if the bindings are buildable. The default implementation assumes that the output is a list of disabled features and that the bindings are implicitly buildable.
PyQtProject
¶
-
class
pyqtbuild.
PyQtProject
(**kwargs)¶ A
Project
sub-class that provides different defaults for some keys in the[tool.sip.project]
section ofpyproject.toml
:the default value of
bindings-factory
isPyQtBindings
the default value of
builder-factory
isQmakeBuilder
the default value of
sip-files-dir
issip
the default value of
sip-module
is PyQt5.sip.
- Parameters
**kwargs – are keyword arguments that define the initial values of any corresponding
Option
defined by the project. AnOption
value set in this way cannot be overridden in thepyproject.toml
file or by using a tool command line option.
PyQtProject
adds the following keys to the[tool.sip.project]
section ofpyproject.toml
:- link-full-dll
The boolean value specifies if, on Windows, the full Python DLL should be linked against rather than the limited API DLL. This is also a user option.
- py-pylib-dir
The value is the name of the directory containing the target Python interpreter library. By default this is determined dynamically from the Python installation.
- py-pylib-lib
The value is the name of the target Python interpreter library. By default this is determined dynamically from the Python installation.
- py-pylib-shlib
The value is the name of the target Python interpreter library if it is a shared library. By default this is determined dynamically from the Python installation.
- qml-debug
The boolean value specifies if the QML debugging infrastructure should be enabled. This is also a user option.
- tag-prefix
The value is the prefix of the timeline tag to use (with the Qt version automatically appended). By default the value of the
name
key in the[tool.sip.metadata]
section ofpyproject.toml
is used with any leadingPy
removed.- tests-dir
The value is the name of the directory, relative to the directory containing
pyproject.toml
, containing any external test programs. The default value isconfig-tests
.
QmakeBuilder
¶
-
class
pyqtbuild.
QmakeBuilder
(project, **kwargs)¶ A
Builder
sub-class that uses Qt’s qmake program to build and install a project.- Parameters
project (Project) – is the
Project
object.**kwargs – are keyword arguments that define the initial values of any corresponding
Option
defined by the project. AnOption
value set in this way cannot be overridden in thepyproject.toml
file or by using a tool command line option.
QmakeBuilder
adds the following keys to the[tool.sip.builder]
section ofpyproject.toml
:- make
The boolean value specifies if make (or nmake on Windows) is executed automatically. By default it is executed automatically. This is also a user option.
- qmake
The value is the full path name of the qmake executable. By default it is assumed to be on
PATH
. This is also a user option.- qmake-settings
The value is a list of strings of the form
'NAME += VALUE'
that are added to any.pro
file generated by the builder. This is also a user option.- spec
The value is passed as the
-spec
argument to qmake whenever it is executed by the builder. This is also a user option.
-
static
qmake_quote
(path)¶ If a file or directory path contains spaces then it is escaped so it can be used in a
.pro
file.- Parameters
path (str) – the path.
- Returns
the path, quoted if necessary.
-
qt_configuration
¶ A dict containing the Qt configuration information returned by running
qmake -query
.
QmakeTargetInstallable
¶
-
class
pyqtbuild.
QmakeTargetInstallable
(target, target_subdir)¶ A
Installable
sub-class used to describe theTARGET
of a.pro
file.