From f61c35cc7f9848a18c5d66a2d7d11dfb9de53199 Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Oct 02 2019 02:23:31 +0000 Subject: Upstream patch for PyQt4 4.12.2 support (bugz#1753414) Switch to Qt5 for Fedora 32+ --- diff --git a/452.patch b/452.patch new file mode 100644 index 0000000..de4f17e --- /dev/null +++ b/452.patch @@ -0,0 +1,78 @@ +From 6e4b67fed40687ca2f7dcd028e8b80f4394f75c3 Mon Sep 17 00:00:00 2001 +From: Corran Webster +Date: Sun, 29 Sep 2019 10:45:30 +0100 +Subject: [PATCH 1/2] Support PyQt 4.12.2. + +--- + pyface/qt/__init__.py | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/pyface/qt/__init__.py b/pyface/qt/__init__.py +index 6aa63f8d..70846131 100644 +--- a/pyface/qt/__init__.py ++++ b/pyface/qt/__init__.py +@@ -25,7 +25,11 @@ def prepare_pyqt4(): + """ Set PySide compatible APIs. """ + # This is not needed for Python 3 and can be removed when we no longer + # support Python 2. +- import sip ++ try: ++ # required for PyQt >= 4.12.2 ++ from PyQt4 import sip ++ except ImportError: ++ import sip + try: + sip.setapi('QDate', 2) + sip.setapi('QDateTime', 2) +@@ -56,7 +60,7 @@ def prepare_pyqt4(): + for api_name, module in QtAPIs: + if module in sys.modules: + qt_api = api_name +- if qt_api == 'pyqt': ++ if qt_api == 'pyqt' and sys.version_info[0] <= 2: + # set the PyQt4 APIs + # this is a likely place for failure - pyface really wants to be + # imported first, before eg. matplotlib + +From 8b2e3261b556a7767add7b6fb4d003ff711f1c9a Mon Sep 17 00:00:00 2001 +From: Corran Webster +Date: Mon, 30 Sep 2019 07:54:31 +0100 +Subject: [PATCH 2/2] Remove extra check for Python 2. + +--- + pyface/qt/__init__.py | 22 +++++++++------------- + 1 file changed, 9 insertions(+), 13 deletions(-) + +diff --git a/pyface/qt/__init__.py b/pyface/qt/__init__.py +index 70846131..c1dff630 100644 +--- a/pyface/qt/__init__.py ++++ b/pyface/qt/__init__.py +@@ -39,19 +39,15 @@ def prepare_pyqt4(): + sip.setapi('QUrl', 2) + sip.setapi('QVariant', 2) + except ValueError as exc: +- if sys.version_info[0] <= 2: +- # most likely caused by something else setting the API version +- # before us: try to give a better error message to direct the user +- # how to fix. +- msg = exc.args[0] +- msg += (". Pyface expects PyQt API 2 under Python 2. " +- "Either import Pyface before any other Qt-using packages, " +- "or explicitly set the API before importing any other " +- "Qt-using packages.") +- raise ValueError(msg) +- else: +- # don't expect the above on Python 3, so just re-raise +- raise ++ # most likely caused by something else setting the API version ++ # before us: try to give a better error message to direct the user ++ # how to fix. ++ msg = exc.args[0] ++ msg += (". Pyface expects PyQt API 2 under Python 2. " ++ "Either import Pyface before any other Qt-using packages, " ++ "or explicitly set the API before importing any other " ++ "Qt-using packages.") ++ raise ValueError(msg) + + + qt_api = None diff --git a/python-pyface.spec b/python-pyface.spec index a316aa2..0801419 100644 --- a/python-pyface.spec +++ b/python-pyface.spec @@ -6,7 +6,7 @@ Name: python-%{modname} Version: 6.1.2 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Generic User Interface objects # Images have different licenses. For image license breakdown check @@ -17,6 +17,9 @@ URL: https://github.com/enthought/pyface # https://github.com/enthought/pyface/issues/98 #Source0: http://www.enthought.com/repo/ets/pyface-%{version}.tar.gz Source0: https://github.com/enthought/pyface/archive/%{version}/pyface-%{version}.tar.gz +# Support for PyQt4 4.12.2 +Patch0: https://patch-diff.githubusercontent.com/raw/enthought/pyface/pull/452.patch + BuildArch: noarch BuildRequires: /usr/bin/xvfb-run @@ -65,19 +68,28 @@ Documentation and examples for pyface. Summary: Qt backend placeholder for pyface %{?python_provide:%python_provide python%{python3_pkgversion}-%{modname}-qt} Requires: python%{python3_pkgversion}-%{modname} = %{version}-%{release} +%if 0%{?fedora} >= 32 +BuildRequires: python%{python3_pkgversion}-PyQt5 +BuildRequires: python%{python3_pkgversion}-qt5-webkit +BuildRequires: python%{python3_pkgversion}-pyqt5-sip +Requires: python%{python3_pkgversion}-PyQt5 +Requires: python%{python3_pkgversion}-qt5-webkit +%{?_sip_api:Requires: python3-pyqt5-sip-api(%{_sip_api_major}) >= %{_sip_api}} +%else BuildRequires: python%{python3_pkgversion}-PyQt4 BuildRequires: python%{python3_pkgversion}-PyQt4-webkit -BuildRequires: python%{python3_pkgversion}-sip +BuildRequires: python%{python3_pkgversion}-pyqt4-sip Requires: python%{python3_pkgversion}-PyQt4 Requires: python%{python3_pkgversion}-PyQt4-webkit -Requires: python%{python3_pkgversion}-sip +%{?_sip_api:Requires: python3-pyqt4-sip-api(%{_sip_api_major}) >= %{_sip_api}} +%endif Provides: python%{python3_pkgversion}-%{modname}-backend %description -n python%{python3_pkgversion}-%{modname}-qt Qt backend placeholder for pyface. %prep -%setup -qn pyface-%{version} +%autosetup -p1 -n pyface-%{version} # file not utf-8 for f in image_LICENSE_{Eclipse,OOo}.txt do @@ -105,6 +117,10 @@ PYTHONPATH=%{buildroot}%{python3_sitelib} xvfb-run nosetests-%{python3_version} %files -n python%{python3_pkgversion}-%{modname}-qt %changelog +* Tue Oct 1 2019 Orion Poplawski - 6.1.2-2 +- Upstream patch for PyQt4 4.12.2 support (bugz#1753414) +- Switch to Qt5 for Fedora 32+ + * Thu Aug 22 2019 Orion Poplawski - 6.1.2-1 - Update to 6.1.2 - Enable bootstrap