Sync from SUSE:SLFO:Main python3-pyside2 revision a6db82912bac4a277eab19dc52ff1f56

This commit is contained in:
Adrian Schröter 2024-09-11 10:23:04 +02:00
parent 17e14e33f3
commit f4f8f730b2
3 changed files with 96 additions and 36 deletions

4
_multibuild Normal file
View File

@ -0,0 +1,4 @@
<multibuild>
<flavor>sle15_python_module</flavor>
</multibuild>

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Fri Jan 26 14:34:01 UTC 2024 - Ben Greiner <code@bnavigator.de>
- Enable SLE15 python module for a more modern python than 3.6
* disambiguate multiple providers of cmake(Pyside2) with
pyside2_python_abi() provides
- Use llvm14 for 15.6 in order to workaround PYSIDE-2288:
* Wrong type for QEvent::Type
* avoids patch like deb#1051886 for libqt5-qtbase
-------------------------------------------------------------------
Fri Jan 12 09:22:25 UTC 2024 - Antonio Larrosa <alarrosa@suse.com>

View File

@ -18,10 +18,25 @@
%bcond_without tests
%global flavor @BUILD_FLAVOR@%{nil}
%if "%flavor" == "sle15_python_module"
%{?sle15_python_module_pythons}
%{!?sle15_python_module_pythons:ExclusiveArch: donotbuild}
%{!?sle15_python_module_pythons:BuildRequires: no-build-without-sle15_python_module}
%else
# SLE15: python3.6, Tumbleweed: primary python
%define pythons python3
%endif
%global mypython %pythons
%global __mypython %{expand:%%__%{mypython}}
%global mypython_sitearch %{expand:%%%{mypython}_sitearch}
%global mypython_version_nodots %{expand:%%%{mypython}_version_nodots}
%global mypython_soflags %(%__mypython -c "import sysconfig; print(sysconfig.get_config_var('SOABI'))")
# QML imports created and used by examples
%global __requires_exclude qmlimport\\((Charts|TextBalloonPlugin)
Name: python3-pyside2
Name: %{mypython}-pyside2
Version: 5.15.12
Release: 0
Summary: Python bindings for Qt
@ -41,30 +56,41 @@ Patch2: 0001-cmake-Don-t-assume-qhelpgenerator-is-in-PATH.patch
# PATCH-FIX-UPSTREAM
Patch3: 0001-Fix-tests-sample_privatector-sample_privatedtor-fail.patch
# Provide the PyPI names
Provides: python3-PySide2 = %{version}-%{release}
Provides: python3-shiboken2 = %{version}-%{release}
Provides: python3-shiboken2_generator = %{version}-%{release}
Provides: %{mypython}-PySide2 = %{version}-%{release}
Provides: %{mypython}-shiboken2 = %{version}-%{release}
Provides: %{mypython}-shiboken2_generator = %{version}-%{release}
Requires(post): update-alternatives
Requires(postun):update-alternatives
# SECTION common_dependencies
%if 0%{?suse_version} > 1500
# boo#1210176 - PYSIDE-2268
BuildRequires: clang15-devel
BuildRequires: llvm15-libclang13
#!BuildIgnore: clang16
#!BuildIgnore: clang17
%else
%if 0%{?sle_version} >= 150600
# boo#1210176 - PYSIDE-2268, PY-2288
BuildRequires: clang14-devel
BuildRequires: llvm14-libclang13
#!BuildIgnore: clang16
#!BuildIgnore: clang17
%else
BuildRequires: clang-devel >= 3.9
%endif
%endif
BuildRequires: %{mypython}-Sphinx
BuildRequires: %{mypython}-devel
BuildRequires: %{mypython}-idna
BuildRequires: %{mypython}-setuptools
BuildRequires: %{mypython}-urllib3
BuildRequires: %{mypython}-wheel
BuildRequires: cmake
BuildRequires: fdupes
BuildRequires: gcc-c++
BuildRequires: libqt5-qtdeclarative-private-headers-devel
BuildRequires: libxslt-devel
BuildRequires: python-rpm-macros
BuildRequires: python3-Sphinx
BuildRequires: python3-devel
BuildRequires: python3-idna
BuildRequires: python3-setuptools
BuildRequires: python3-urllib3
BuildRequires: python3-wheel
%if %{with tests}
BuildRequires: Mesa-dri
BuildRequires: xvfb-run
@ -124,6 +150,12 @@ application and UI framework.
Summary: Header Files for PySide2
License: (GPL-2.0-only AND (GPL-2.0-only OR GPL-3.0-or-later) AND GPL-3.0-only WITH Qt-GPL-exception-1.0) OR LGPL-3.0-only
Requires: %{name} = %{version}
# can be used to disambiguate multiple providers of cmake(PySide2) and cmake(Shiboken2)
Provides: pyside2_python_abi(%{mypython_soflags}) = %{version}
%if "%{mypython}" != "python3"
# Can only build for one flavor at a time
Conflicts: python3-pyside2-devel
%endif
%description devel
Files needed for development with the PySide2 bindings
@ -133,6 +165,9 @@ for Qt.
Summary: Examples for using PySide2
License: BSD-3-Clause
Requires: %{name} = %{version}
%if "%{mypython}" != "python3"
Conflicts: python3-pyside2-examples
%endif
BuildArch: noarch
%description examples
@ -150,7 +185,7 @@ _libsuffix=$(echo %{_lib} | cut -b4-)
-DCMAKE_C_FLAGS:STRING="" \
-DCMAKE_CXX_FLAGS:STRING="" \
-DCMAKE_EXE_LINKER_FLAGS:STRING="" \
-DPYTHON_EXECUTABLE:STRING=python3 \
-DPYTHON_EXECUTABLE:STRING=%{__mypython} \
-DCMAKE_BUILD_RPATH_USE_ORIGIN:BOOL=ON \
%if %{with tests}
-DBUILD_TESTS:BOOL=ON
@ -161,10 +196,11 @@ _libsuffix=$(echo %{_lib} | cut -b4-)
%install
%cmake_install
sed -i 's#env python$#python%{python3_bin_suffix}#' \
%{buildroot}%{_bindir}/pyside_tool.py
%python_clone -a %{buildroot}%{_bindir}/pyside2-lupdate
%python_clone -a %{buildroot}%{_bindir}/pyside_tool.py
%python_clone -a %{buildroot}%{_bindir}/shiboken2
# Broken and conflicts with python3-pyside6
# Broken and conflicts with python3X-pyside6
rm %{buildroot}%{_bindir}/shiboken_tool.py
# No use on linux
@ -174,16 +210,16 @@ rm %{buildroot}%{_datadir}/PySide2/typesystems/*_{mac,win}.xml
cp -r build/sources/pyside2/PySide2/*.pyi \
build/sources/pyside2/PySide2/py.typed \
build/sources/pyside2/PySide2/support \
%{buildroot}%{python3_sitearch}/PySide2/
%{buildroot}%{mypython_sitearch}/PySide2/
# this is not ideal, but at least we get some python dist metadata
python3 setup.py dist_info
%{__mypython} setup.py dist_info
for d in *.dist-info; do
# the commands were copied verbatim, not wrapped by entry-points.
rm -f $d/entry_points.txt
%if %{pkg_vcmp python3-setuptools < 63}
cp -r $d %{buildroot}%{python3_sitearch}/${d/.dist-info/-%{version}.dist-info}
%if %{pkg_vcmp %{mypython}-setuptools < 63}
cp -r $d %{buildroot}%{mypython_sitearch}/${d/.dist-info/-%{version}.dist-info}
%else
cp -r $d %{buildroot}%{python3_sitearch}/${d}
cp -r $d %{buildroot}%{mypython_sitearch}/${d}
%endif
done
@ -192,14 +228,14 @@ cp -R examples %{buildroot}%{_datadir}/PySide2
%fdupes %{buildroot}%{_datadir}/PySide2/examples/
%fdupes %{buildroot}%{_libqt5_libdir}/cmake/
%fdupes %{buildroot}%{python3_sitearch}
%fdupes %{buildroot}%{mypython_sitearch}
%check
%if %{with tests}
# Set some environment variables
export PATH=%{_libqt5_bindir}:$PATH
export LD_LIBRARY_PATH=%{buildroot}%{_libqt5_libdir}:$LD_LIBRARY_PATH
export PYTHONPATH=%{buildroot}%{python3_sitearch}:$PWD/build/sources/pyside2/tests/pysidetest
export PYTHONPATH=%{buildroot}%{mypython_sitearch}:$PWD/build/sources/pyside2/tests/pysidetest
%if 0%{?sle_version} && 0%{?sle_version} <= 150300
# Leap 15.3: ctest searches the libs before shiboken_paths.py can set the search path (!?)
for binding in $PWD/build/sources/shiboken2/tests/lib*; do
@ -218,7 +254,7 @@ ctest_exclude_regex="$ctest_exclude_regex|registry_existence_test"
ctest_exclude_regex="$ctest_exclude_regex|QtWebEngineWidgets_pyside-474-qtwebengineview"
ctest_exclude_regex="$ctest_exclude_regex|QtWebEngineCore_web_engine_custom_scheme"
%if 0%{?suse_version} > 1500
%if %{mypython_version_nodots} >= 311
# Blacklist broken test with python 3.11
ctest_exclude_regex="$ctest_exclude_regex|signal_enum_test|QtCore_qenum_test"
%endif
@ -247,29 +283,39 @@ pushd build/sources/pyside2
popd
%endif
%ldconfig_scriptlets
%post
%{?ldconfig}
%python_install_alternative pyside2-lupdate
%python_install_alternative pyside_tool.py
%python_install_alternative shiboken2
%postun
%{?ldconfig}
%python_uninstall_alternative pyside2-lupdate
%python_uninstall_alternative pyside_tool.py
%python_uninstall_alternative shiboken2
%files
%license LICENSE.*
%doc dist/changes*
%{_bindir}/pyside2-lupdate
%{_bindir}/pyside_tool.py
%{_bindir}/shiboken2
%{_libqt5_libdir}/libpyside2.%{py3_soflags}.so.*
%{_libqt5_libdir}/libshiboken2.%{py3_soflags}.so.*
%{python3_sitearch}/PySide2/
%{python3_sitearch}/PySide2-%{version}.dist-info
%{python3_sitearch}/shiboken2/
%{python3_sitearch}/shiboken2-%{version}.dist-info
%{python3_sitearch}/shiboken2_generator/
%{python3_sitearch}/shiboken2_generator-%{version}.dist-info
%python_alternative %{_bindir}/pyside2-lupdate
%python_alternative %{_bindir}/pyside_tool.py
%python_alternative %{_bindir}/shiboken2
%{_libqt5_libdir}/libpyside2.%{mypython_soflags}.so.*
%{_libqt5_libdir}/libshiboken2.%{mypython_soflags}.so.*
%{mypython_sitearch}/PySide2/
%{mypython_sitearch}/PySide2-%{version}.dist-info
%{mypython_sitearch}/shiboken2/
%{mypython_sitearch}/shiboken2-%{version}.dist-info
%{mypython_sitearch}/shiboken2_generator/
%{mypython_sitearch}/shiboken2_generator-%{version}.dist-info
%files devel
%{_datadir}/PySide2/
%{_includedir}/PySide2/
%{_includedir}/shiboken2/
%{_libqt5_libdir}/libpyside2.%{py3_soflags}.so
%{_libqt5_libdir}/libshiboken2.%{py3_soflags}.so
%{_libqt5_libdir}/libpyside2.%{mypython_soflags}.so
%{_libqt5_libdir}/libshiboken2.%{mypython_soflags}.so
%{_libqt5_libdir}/cmake/PySide2-%{version}
%{_libqt5_libdir}/cmake/Shiboken2-%{version}
%{_libqt5_libdir}/pkgconfig/pyside2.pc