2017-05-03 15:15:28 +00:00
|
|
|
#
|
2022-04-11 09:31:42 +00:00
|
|
|
# spec file
|
2017-05-03 15:15:28 +00:00
|
|
|
#
|
2022-04-10 21:49:55 +00:00
|
|
|
# Copyright (c) 2022 SUSE LLC
|
2017-05-03 15:15:28 +00:00
|
|
|
#
|
|
|
|
# All modifications and additions to the file contributed by third parties
|
|
|
|
# remain the property of their copyright owners, unless otherwise agreed
|
|
|
|
# upon. The license for this file, and modifications and additions to the
|
|
|
|
# file, is the same license as for the pristine package itself (unless the
|
|
|
|
# license for the pristine package is not an Open Source License, in which
|
|
|
|
# case the license is the MIT License). An "Open Source License" is a
|
|
|
|
# license that conforms to the Open Source Definition (Version 1.9)
|
|
|
|
# published by the Open Source Initiative.
|
|
|
|
|
2018-12-04 13:58:14 +00:00
|
|
|
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
|
|
|
#
|
2017-05-03 15:15:28 +00:00
|
|
|
|
|
|
|
|
2022-04-11 09:31:42 +00:00
|
|
|
%global flavor @BUILD_FLAVOR@%{nil}
|
|
|
|
%if "%{flavor}" == "test"
|
|
|
|
%define psuffix -test
|
|
|
|
%bcond_without test
|
|
|
|
%else
|
|
|
|
%define psuffix %{nil}
|
|
|
|
%bcond_with test
|
|
|
|
BuildArch: noarch
|
|
|
|
%endif
|
|
|
|
%bcond_without pyqt5
|
2022-04-10 21:49:55 +00:00
|
|
|
%bcond_without pyqt6
|
2022-04-11 09:31:42 +00:00
|
|
|
%ifnarch %power64 s390x
|
|
|
|
%bcond_without pyside2
|
|
|
|
%else
|
|
|
|
%bcond_with pyside2
|
|
|
|
%endif
|
|
|
|
# unfortunately we get a segfault in the other backends when pyside6 is installed at the same time (!?)
|
2022-06-04 08:55:00 +00:00
|
|
|
# test locally: osc build -M test --with pyside6 --without pyside2 --without pyqt5 --without pyqt6 --define "pythons python3"
|
2022-04-10 21:49:55 +00:00
|
|
|
%bcond_with pyside6
|
|
|
|
|
|
|
|
%define skip_python2 1
|
2022-04-11 09:31:42 +00:00
|
|
|
Name: python-QtPy%{psuffix}
|
2022-06-04 08:55:00 +00:00
|
|
|
Version: 2.1.0
|
2017-05-03 15:15:28 +00:00
|
|
|
Release: 0
|
|
|
|
Summary: Abstraction layer on top of Qt bindings
|
2018-12-04 13:58:14 +00:00
|
|
|
License: MIT
|
2017-05-03 15:15:28 +00:00
|
|
|
Group: Development/Languages/Python
|
2019-03-06 10:27:11 +00:00
|
|
|
URL: https://github.com/spyder-ide/qtpy
|
2017-05-03 15:15:28 +00:00
|
|
|
Source: https://files.pythonhosted.org/packages/source/Q/QtPy/QtPy-%{version}.tar.gz
|
2022-06-04 08:55:00 +00:00
|
|
|
BuildRequires: %{python_module base >= 3.7}
|
2022-04-10 21:49:55 +00:00
|
|
|
BuildRequires: %{python_module packaging}
|
2018-12-04 13:58:14 +00:00
|
|
|
BuildRequires: %{python_module setuptools}
|
2018-05-31 19:33:23 +00:00
|
|
|
BuildRequires: fdupes
|
|
|
|
BuildRequires: python-rpm-macros
|
2022-04-10 21:49:55 +00:00
|
|
|
Requires: python-packaging
|
2022-06-04 08:55:00 +00:00
|
|
|
Requires(post): update-alternatives
|
|
|
|
Requires(postun):update-alternatives
|
|
|
|
# Note: Don't add any Requires, Recommends, or Suggests for a
|
|
|
|
# specific backend here, because we need to minimize the space
|
|
|
|
# occupied on the Tumbleweed DVD. The application importing QtPy
|
|
|
|
# will have to know what backend to recommend and what extras to
|
|
|
|
# require (e.g. qtwebengine). Note that setup.py does not declare
|
|
|
|
# any requirements, in this regard either.
|
2022-04-11 09:31:42 +00:00
|
|
|
%if %{with test}
|
2022-06-04 08:55:00 +00:00
|
|
|
BuildRequires: %{python_module QtPy = %{version}}
|
2022-04-10 21:49:55 +00:00
|
|
|
BuildRequires: %{python_module pytest >= 6}
|
|
|
|
BuildRequires: %{python_module pytest-qt}
|
2022-04-11 09:31:42 +00:00
|
|
|
%if %{with pyqt5}
|
2021-08-18 09:54:49 +00:00
|
|
|
BuildRequires: %{python_module qt3d-qt5}
|
|
|
|
BuildRequires: %{python_module qt5}
|
|
|
|
BuildRequires: %{python_module qtcharts-qt5}
|
|
|
|
BuildRequires: %{python_module qtdatavis3d-qt5}
|
2022-04-11 09:31:42 +00:00
|
|
|
%ifnarch %{power64} s390x
|
2021-08-18 09:54:49 +00:00
|
|
|
BuildRequires: %{python_module qtwebengine-qt5}
|
2022-04-11 09:31:42 +00:00
|
|
|
%endif
|
|
|
|
%endif
|
2022-04-10 21:49:55 +00:00
|
|
|
%if %{with pyqt6}
|
|
|
|
BuildRequires: %{python_module PyQt6-3D}
|
|
|
|
BuildRequires: %{python_module PyQt6-Charts}
|
|
|
|
BuildRequires: %{python_module PyQt6-DataVisualization}
|
|
|
|
BuildRequires: %{python_module PyQt6}
|
|
|
|
BuildRequires: qt6-sql-sqlite
|
2022-04-11 09:31:42 +00:00
|
|
|
%ifnarch %{ix86} %{arm} %{power64} s390x
|
|
|
|
# QtWebEngine 6.3.0 ceased support for 32-bit
|
|
|
|
BuildRequires: %{python_module PyQt6-WebEngine}
|
|
|
|
%endif
|
|
|
|
%endif
|
|
|
|
%if %{with pyside2}
|
|
|
|
BuildRequires: python3-pyside2
|
2022-04-10 21:49:55 +00:00
|
|
|
%endif
|
|
|
|
%if %{with pyside6}
|
|
|
|
BuildRequires: python3-pyside6
|
2022-04-11 09:31:42 +00:00
|
|
|
BuildRequires: qt6-sql-sqlite
|
|
|
|
%endif
|
2022-04-10 21:49:55 +00:00
|
|
|
%endif
|
2017-05-03 15:15:28 +00:00
|
|
|
%python_subpackages
|
|
|
|
|
|
|
|
%description
|
2021-08-18 09:54:49 +00:00
|
|
|
QtPy is a small abstraction layer that lets you
|
|
|
|
write applications using a single API call to either PyQt or PySide.
|
2017-05-03 15:15:28 +00:00
|
|
|
|
2022-06-04 08:55:00 +00:00
|
|
|
It provides support for PyQt5, PyQt6, PySide6, PySide2 using the Qt5
|
|
|
|
layout (where the QtGui module has been split into QtGui and QtWidgets).
|
|
|
|
Basically, you can write your code as if you were using PyQt or PySide
|
|
|
|
directly, but import Qt modules from qtpy instead of PyQt5, PySide2,
|
|
|
|
PyQt6 or PySide6.
|
2017-05-03 15:15:28 +00:00
|
|
|
|
|
|
|
%prep
|
|
|
|
%setup -q -n QtPy-%{version}
|
2021-08-18 09:54:49 +00:00
|
|
|
# wrong EOL encondig
|
|
|
|
sed -i 's/\r$//' LICENSE.txt *.md
|
2022-04-10 21:49:55 +00:00
|
|
|
# qtcharts is present in our PyQt
|
2021-08-18 09:54:49 +00:00
|
|
|
sed -i '/skipif.*not PYSIDE2/ d' qtpy/tests/test_qtcharts.py
|
2022-06-04 08:55:00 +00:00
|
|
|
sed -i '/addopts/ s/--cov=.*//' pytest.ini
|
2017-05-03 15:15:28 +00:00
|
|
|
|
|
|
|
%build
|
|
|
|
%python_build
|
|
|
|
|
|
|
|
%install
|
2022-04-11 09:31:42 +00:00
|
|
|
%if ! %{with test}
|
2017-05-03 15:15:28 +00:00
|
|
|
%python_install
|
2022-06-04 08:55:00 +00:00
|
|
|
%python_clone -a %{buildroot}%{_bindir}/qtpy
|
2020-08-28 15:30:34 +00:00
|
|
|
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
2022-04-11 09:31:42 +00:00
|
|
|
%endif
|
2017-05-03 15:15:28 +00:00
|
|
|
|
|
|
|
%check
|
2022-04-11 09:31:42 +00:00
|
|
|
%if %{with test}
|
2018-05-31 19:33:23 +00:00
|
|
|
export QT_HASH_SEED=0
|
2022-04-10 21:49:55 +00:00
|
|
|
export QT_QPA_PLATFORM="offscreen"
|
2018-05-31 19:33:23 +00:00
|
|
|
mkdir empty
|
|
|
|
pushd empty
|
2022-06-04 08:55:00 +00:00
|
|
|
# expects an unset FORCE_QT_API
|
|
|
|
donttest_qt_api="test_qt_api_environ"
|
2022-04-11 09:31:42 +00:00
|
|
|
%ifarch %{arm} aarch64
|
|
|
|
# no QtOpenGL for these platforms
|
|
|
|
donttest=" or test_qtopengl"
|
|
|
|
%endif
|
|
|
|
%if %{with pyqt5}
|
2022-04-10 21:49:55 +00:00
|
|
|
# no QtSensors in our PyQt5
|
|
|
|
donttest_pyqt5=" or test_qtsensors"
|
2022-04-11 09:31:42 +00:00
|
|
|
%ifarch %{power64} s390x
|
|
|
|
# No QtWebengine on ppc and s390x
|
|
|
|
donttest_pyqt5="${donttest_pyqt5} or test_qtwebengine or test_qt_api"
|
|
|
|
%endif
|
2022-04-10 21:49:55 +00:00
|
|
|
export QT_API=pyqt5 FORCE_QT_API=1
|
2022-06-04 08:55:00 +00:00
|
|
|
%pytest -rwEfs -v ../qtpy -k "not ($donttest_qt_api $donttest $donttest_pyqt5)"
|
2022-04-11 09:31:42 +00:00
|
|
|
%endif
|
2022-04-10 21:49:55 +00:00
|
|
|
%if %{with pyqt6}
|
2022-04-11 09:31:42 +00:00
|
|
|
%ifarch %{ix86} %{arm} %{power64} s390x
|
|
|
|
# QtWebEngine 6.3.0 ceased support for 32-bit
|
|
|
|
# No QtWebengine (PyQt5 or PyqQt6 on ppc and s390x
|
|
|
|
donttest_pyqt6=" or test_qtwebengine"
|
|
|
|
%endif
|
2022-04-10 21:49:55 +00:00
|
|
|
export QT_API=pyqt6 FORCE_QT_API=1
|
2022-06-04 08:55:00 +00:00
|
|
|
%pytest -rwEfs -v ../qtpy -k "not ($donttest_qt_api $donttest $donttest_pyqt6)"
|
2022-04-10 21:49:55 +00:00
|
|
|
%endif
|
2022-04-11 09:31:42 +00:00
|
|
|
%if %{with pyside2}
|
2021-08-18 09:54:49 +00:00
|
|
|
export QT_API=pyside2 FORCE_QT_API=1
|
2022-06-04 08:55:00 +00:00
|
|
|
pytest-%{python3_bin_suffix} -rwEfs -v ../qtpy -k "not ($donttest_qt_api $donttest)"
|
2022-04-11 09:31:42 +00:00
|
|
|
%endif
|
2022-04-10 21:49:55 +00:00
|
|
|
%if %{with pyside6}
|
|
|
|
export QT_API=pyside6 FORCE_QT_API=1
|
2022-06-04 08:55:00 +00:00
|
|
|
pytest-%{python3_bin_suffix} -rwEfs -v ../qtpy -k "not ($donttest_qt_api $donttest)"
|
2022-04-10 21:49:55 +00:00
|
|
|
%endif
|
2022-06-04 08:55:00 +00:00
|
|
|
# Default backend
|
|
|
|
unset QT_API
|
|
|
|
unset FORCE_QT_API
|
|
|
|
%pytest -rwEfs -vvv ../qtpy -k "not (dummyprefix $donttest $donttest_pyqt5)"
|
2018-05-31 19:33:23 +00:00
|
|
|
popd
|
2022-04-11 09:31:42 +00:00
|
|
|
%endif
|
2017-05-03 15:15:28 +00:00
|
|
|
|
2022-06-04 08:55:00 +00:00
|
|
|
%post
|
|
|
|
%python_install_alternative qtpy
|
|
|
|
|
|
|
|
%postun
|
|
|
|
%python_uninstall_alternative qtpy
|
|
|
|
|
2022-04-11 09:31:42 +00:00
|
|
|
%if ! %{with test}
|
2017-05-03 15:15:28 +00:00
|
|
|
%files %{python_files}
|
2018-05-31 19:33:23 +00:00
|
|
|
%doc AUTHORS.md CHANGELOG.md README.md
|
|
|
|
%license LICENSE.txt
|
2020-08-28 15:30:34 +00:00
|
|
|
%{python_sitelib}/qtpy
|
2022-04-10 21:49:55 +00:00
|
|
|
%{python_sitelib}/QtPy-%{version}*-info
|
2022-06-04 08:55:00 +00:00
|
|
|
%python_alternative %{_bindir}/qtpy
|
2022-04-11 09:31:42 +00:00
|
|
|
%endif
|
2017-05-03 15:15:28 +00:00
|
|
|
|
|
|
|
%changelog
|