The wikis are now using the new authentication system.
If you did not migrate your account yet, visit https://idp-portal-info.suse.com/

openSUSE:Packaging PyQt5 and SIP

Jump to: navigation, search


The Packaging PyQt5 and SIP guide is an overview how to package Python software packages which build on top of the PyQt and SIP frameworks for openSUSE and others using the openSUSE Build Service.

PyQt is a set of Python bindings for The Qt framework. It is using SIP as build backend. SIP is a tool that makes it very easy to create Python bindings for C and C++ libraries.

Build Requirements

Packages building with SIP5 need the package python-sip-devel.

BuildRequires:  %{python_module sip-devel}

If your package depends on deprecated SIP4, use the python-sip4-devel package:

BuildRequires:  %{python_module sip4-devel}

The PyQt5 family has a dedicated package enhancing the SIP5 build system:

BuildRequires:  %{python_module pyqt-builder}

Runtime Requirements

Packages using SIP4 historically imported the deprecated Python top level module sip. To ensure binary compatibility, the sip4-devel packages provides a macro specifying the correct version:

Requires:       python-sip(api) = %{python_sip_api_ver}

Newer packages use the Python module PyQt5.sip. To require the same version as used during build time:

%requires_eq    python-qt5-sip

Macros

We use a set of helper macros for building PyQt5 packages using either SIP4 or SIP5. These are mainly intended for the core PyQt5 packages, but could come in handy for other SIP based software as well.

BuildRequires:  python-pyqt-rpm-macros

%define use_sip4 1

Define this for distributions or packages where SIP4 is required

%sip4_only() and %sip5_only()

Apply the arguments only for SIP4 or SIP5 builds in case %use_sip4 is only defined for a subset of builds.

%pyqt5_sipdir

The path to the directory where the .sip bindings files are located

The follow macros take care of the build dir shuffles for different python flavors.

%pyqt_build()

Build instructions for the package using SIP4 or SIP5 as defined by %use_sip4

Options:

  • -c %{quote:--configure-parameters}: Additional parameters for configure.py used by SIP4 builds.
  • -v: Required for "non-standard" configure.py: call configure.py --verbose instead of standard configure -w.
  • -s %{quote:--sip-build-parameters}: Additional parameters for SIP5's sip-build.
  • -m %{quote:make_flags}: Additional parameters for make.

%pyqt_install

Install instructions for the package using SIP4 or SIP5.

%pyqt_install_examples suffix

Install the examples subdirectory into %_docdir/%python_prefix-suffix and adjust the script-interpreter line (shebang) for the correct Python flavor.