File mingw-python-pyqt6-sip.spec of Package mingw-python-pyqt6-sip

%{?vortex_header}%{!?vortex_header:%global vortex_pkg vortex-2025-12}

%{?mingw_package_header}


# ================= IT SHOULD NOT BE NECESSARY TO MAKE CHANGES BELOW ==============================

# Avoid duplicate build-id files between bundles
%global _build_id_links none

# ==================
# Top-level metadata
# ==================

Name: %{vortex_pkg}-mingw64-python3-pyqt6-sip
Summary: SIP module for PyQt6
URL: http://www.riverbankcomputing.com/software/sip/intro
License: GPLv2 or GPLv3 and (GPLv3+ with exceptions)

Version: 13.10.2
# Release number will be determined by SUSE open build service
Release: 0.0

# =======================
# Build-time requirements
# =======================

BuildArch:      noarch

BuildRequires:  %{vortex_pkg}-mingw64-filesystem
BuildRequires:  %{vortex_pkg}-mingw64-binutils
BuildRequires:  %{vortex_pkg}-mingw64-headers
BuildRequires:  %{vortex_pkg}-mingw64-gcc-c++
BuildRequires:  %{vortex_pkg}-mingw64-gettext

BuildRequires:  cmake
BuildRequires:  %{vortex_pkg}-python3-scikit-build
BuildRequires:  %{vortex_pkg}-mingw64-python3


# =======================
# Source code and patches
# =======================

Source0: pyqt6_sip-%{version}.tar.gz

Source2: CMakeLists.txt

Patch: vortex.diff

# ==========================================
# Descriptions, and metadata for subpackages
# ==========================================

Requires: %{vortex_pkg}-mingw64-python3

%description
Custom Vortex sip python module build.

# ======================================================
# The prep phase of the build:
# ======================================================
%prep
%autosetup -p1 -n pyqt6_sip-%{version}

cp %{SOURCE2} .

# ======================================================
# Configuring and building the code:
# ======================================================

%build
# determine python version (e.g. 3.4)
%global python_version $(%{_bindir}/python3 -c 'import sys; print("{}.{}".format(sys.version_info.major, sys.version_info.minor))')

%mingw64_env

%{_bindir}/python3 setup.py bdist \
    -- \
    -DCMAKE_TOOLCHAIN_FILE=%{_prefix}/share/mingw/toolchain-mingw64.cmake \
    -DPYTHON_INCLUDE_DIR=%{mingw64_prefix}/include/python%{python_version} \
    -DPYTHON_LIBRARY=%{mingw64_prefix}/bin/libpython%{python_version}.dll


# ======================================================
# Installing the built code:
# ======================================================

%install
mkdir -p %{buildroot}
tar -x -f dist/pyqt6_sip-%{version}.linux-x86_64.tar.gz -C %{buildroot}

mkdir -p %{buildroot}%{mingw64_prefix}/lib/python3.11/site-packages
mv %{buildroot}%{_prefix}/lib/python3.11/site-packages/PyQt6.sip.pyd %{buildroot}%{mingw64_prefix}/lib/python3.11/site-packages/PyQt6.sip.pyd
rmdir %{buildroot}%{_prefix}/lib/python3.11/site-packages

mv %{buildroot}%{_prefix}/lib64/python3.11/site-packages/PyQt6_sip-13.10.2-py3.11.egg-info %{buildroot}%{mingw64_prefix}/lib/python3.11/site-packages
rmdir %{buildroot}%{_prefix}/lib64/python3.11/site-packages

# make sure py files are byte-compiled
%{_bindir}/python3 -m compileall %{buildroot}


%files
# include all files for now
%{mingw64_prefix}

openSUSE Build Service is sponsored by