pyqtbuild Module Reference

The pyqtbuild module provides a number of API elements that can be used by a project’s project.py file.

PYQTBUILD_VERSION

pyqtbuild.PYQTBUILD_VERSION

This is a Python integer object that represents the version number of the pyqtbuild module as a 3 part hexadecimal number (e.g. v1.5.0 is represented as 0x010500).

PYQTBUILD_VERSION_STR

pyqtbuild.PYQTBUILD_VERSION_STR

This is a Python string object that defines the version number of the pyqtbuild module as represented as a string. For development versions it will contain .dev.

PyQtBindings

class pyqtbuild.PyQtBindings(project, name, **kwargs)

A sipbuild.Bindings sub-class that configures a QmakeBuilder 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 and test-statement keys 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.

Parameters:
  • project (PyQtProject) – is the project.

  • name (str) – is the name of the bindings.

  • **kwargs – are keyword arguments that define the initial values of any corresponding sipbuild.Option defined by the bindings. A sipbuild.Option value set in this way cannot be overridden in the pyproject.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.

Parameters:

test_output (list[str]) – is the output from an external test program.

Returns:

True if the bindings are buildable.

PyQtProject

class pyqtbuild.PyQtProject(**kwargs)

A sipbuild.Project sub-class that provides different defaults for some keys in the [tool.sip.project] section of pyproject.toml:

  • the default value of bindings-factory is PyQtBindings

  • the default value of builder-factory is QmakeBuilder

  • the default value of sip-files-dir is sip

  • the default value of sip-module is determined by the version of Qt

  • the default value of abi-version is determined by the value of sip-module.

Parameters:

**kwargs – are keyword arguments that define the initial values of any corresponding sipbuild.Option defined by the project. A sipbuild.Option value set in this way cannot be overridden in the pyproject.toml file or by using a tool command line option.

QmakeBuilder

class pyqtbuild.QmakeBuilder(project, **kwargs)

A sipbuild.Builder sub-class that uses Qt’s qmake program to build and install a project.

Parameters:
  • project (Project) – is the sipbuild.Project object.

  • **kwargs – are keyword arguments that define the initial values of any corresponding sipbuild.Option defined by the project. A sipbuild.Option value set in this way cannot be overridden in the pyproject.toml file or by using a tool command line 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 sipbuild.Installable sub-class used to describe the TARGET of a .pro file.

Parameters:
  • target (str) – is the file name of the target.

  • target_subdir (str) – is the relative path name of a sub-directory in which the installable’s files will be installed. If it is an absolute path name then it is used as the eventual full target directory.