rpms/PyQt4/devel PyQt4.spec,1.48,1.49

dmalcolm dmalcolm at fedoraproject.org
Tue Apr 27 20:30:41 UTC 2010


Author: dmalcolm

Update of /cvs/pkgs/rpms/PyQt4/devel
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv25659

Modified Files:
	PyQt4.spec 
Log Message:
add python 3 subpackages (#586196)



Index: PyQt4.spec
===================================================================
RCS file: /cvs/pkgs/rpms/PyQt4/devel/PyQt4.spec,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -p -r1.48 -r1.49
--- PyQt4.spec	17 Apr 2010 20:45:48 -0000	1.48
+++ PyQt4.spec	27 Apr 2010 20:30:41 -0000	1.49
@@ -1,10 +1,12 @@
 
 # Fedora review: http://bugzilla.redhat.com/190189
 
+%global with_python3 1
+
 Summary: Python bindings for Qt4
 Name: 	 PyQt4
 Version: 4.7.3
-Release: 1%{?dist}
+Release: 2%{?dist}
 
 # GPLv2 exceptions(see GPL_EXCEPTIONS*.txt)
 License: GPLv3 or GPLv2 with exceptions
@@ -39,6 +41,11 @@ BuildRequires: python-devel
 
 BuildRequires: sip-devel >= 4.10.2
 
+%if 0%{?with_python3}
+BuildRequires: python3-devel
+BuildRequires: python3-sip-devel >= 4.10.2
+%endif # with_python3
+
 Requires: dbus-python
 %{?_qt4_version:Requires: qt4 >= %{_qt4_version}}
 %{?_sip_api:Requires: sip-api(%{_sip_api_major}) >= %{_sip_api}}
@@ -56,6 +63,37 @@ Requires: sip-devel
 Files needed to build other bindings for C++ classes that inherit from any
 of the Qt4 classes (e.g. KDE or your own).
 
+%if 0%{?with_python3}
+
+# The bindings are imported as "PyQt4", hence it's reasonable to name the
+# Python 3 subpackage "python3-PyQt4", despite the apparent tautology
+
+%package -n python3-PyQt4
+Summary: Python 3 bindings for Qt4
+Group:   Development/Languages
+
+# The dbus Python bindings have not yet been ported to Python 3:
+# Requires: dbus-python
+
+%{?_qt4_version:Requires: qt4 >= %{_qt4_version}}
+%{?_sip_api:Requires: python3-sip-api(%{_sip_api_major}) >= %{_sip_api}}
+
+%description -n python3-PyQt4
+These are Python 3 bindings for Qt4.
+
+%package -n python3-PyQt4-devel
+Summary: Python 3 bindings for Qt4
+Group:   Development/Languages
+Requires: %{name} = %{version}-%{release}
+Requires: python3-PyQt4-devel
+Requires: python3-sip-devel
+
+%description -n python3-PyQt4-devel
+Files needed to build other Python 3 bindings for C++ classes that inherit
+from any of the Qt4 classes (e.g. KDE or your own).
+
+%endif # with_python3
+
 
 %prep
 %setup -q -n PyQt-x11-gpl-%{version}%{?snap:-snapshot-%{snap}}
@@ -71,12 +109,17 @@ of the Qt4 classes (e.g. KDE or your own
 find examples/ -name "*.py" | xargs chmod a-x
 chmod a+rx pyuic/uic/pyuic.py
 
+%if 0%{?with_python3}
+rm -rf %{py3dir}
+cp -a . %{py3dir}
+%endif # with_python3
 
 %build
 
 QT4DIR=%{_qt4_prefix}
 PATH=%{_qt4_bindir}:$PATH ; export PATH
 
+# Python 2 build:
 %{__python} configure.py \
   --confirm-license \
   --qmake=%{_qt4_qmake} \
@@ -84,25 +127,56 @@ PATH=%{_qt4_bindir}:$PATH ; export PATH
 
 make %{?_smp_mflags}
 
+# Python 3 build:
+%if 0%{?with_python3}
+pushd %{py3dir}
+%{__python3} configure.py \
+  --confirm-license \
+  --qmake=%{_qt4_qmake} \
+  --verbose 
+
+make %{?_smp_mflags}
+popd
+%endif # with_python3
+
 
 %install
 rm -rf %{buildroot}
 
-make install DESTDIR=%{buildroot} INSTALL_ROOT=%{buildroot}
+InstallPyQt4() {
+  PySiteArch=$1
+
+  make install DESTDIR=%{buildroot} INSTALL_ROOT=%{buildroot}
+
+  # fix/remove rpaths
+  chrpath --list   %{buildroot}$PySiteArch/PyQt4/QtCore.so
+  chrpath --delete %{buildroot}$PySiteArch/PyQt4/QtCore.so
 
-# fix/remove rpaths
-chrpath --list   %{buildroot}%{python_sitearch}/PyQt4/QtCore.so
-chrpath --delete %{buildroot}%{python_sitearch}/PyQt4/QtCore.so
+  chrpath --list   %{buildroot}$PySiteArch/PyQt4/QtGui.so
+  chrpath --delete %{buildroot}$PySiteArch/PyQt4/QtGui.so
 
-chrpath --list   %{buildroot}%{python_sitearch}/PyQt4/QtGui.so
-chrpath --delete %{buildroot}%{python_sitearch}/PyQt4/QtGui.so
+  chrpath --list   %{buildroot}$PySiteArch/PyQt4/QtDesigner.so
+  chrpath --delete %{buildroot}$PySiteArch/PyQt4/QtDesigner.so
+}
 
-chrpath --list   %{buildroot}%{python_sitearch}/PyQt4/QtDesigner.so
-chrpath --delete %{buildroot}%{python_sitearch}/PyQt4/QtDesigner.so
 
+
+# Install Python 3 first, and move aside any executables, to avoid clobbering
+# the Python 2 installation:
+%if 0%{?with_python3}
+pushd %{py3dir}
+InstallPyQt4 %{python3_sitearch}
+popd
+%endif # with_python3
+
+InstallPyQt4 %{python_sitearch}
+
+# DBus bindings only work for Python 2 so far:
 chrpath --list   %{buildroot}%{python_sitelib}/dbus/mainloop/qt.so
 chrpath --delete %{buildroot}%{python_sitelib}/dbus/mainloop/qt.so
 
+
+
 # HACK: fix multilb conflict, http://bugzilla.redhat.com/509415
 rm -fv %{buildroot}%{_bindir}/pyuic4
 mv %{buildroot}%{python_sitearch}/PyQt4/uic/pyuic.py \
@@ -113,12 +187,19 @@ ln -s %{_bindir}/pyuic4 \
 # remove Python 3 code from Python 2.6 directory, fixes FTBFS (#564633)
 rm -rf %{buildroot}%{python_sitearch}/PyQt4/uic/port_v3/
 
+# likewise, remove Python 2 code from the Python 3.1 directory:
+rm -rf %{buildroot}%{python3_sitearch}/PyQt4/uic/port_v2/
+
 
 %check
 # verify phonon built ok
 test -f %{buildroot}%{python_sitearch}/PyQt4/phonon.so
 test -d %{buildroot}%{_datadir}/sip/PyQt4/phonon
 
+%if 0%{?with_python3}
+test -f %{buildroot}%{python3_sitearch}/PyQt4/phonon.so
+test -d %{buildroot}%{_datadir}/python3-sip/PyQt4/phonon
+%endif # with_python3
 
 %clean
 rm -rf %{buildroot}
@@ -149,8 +230,30 @@ rm -rf %{buildroot}
 %{_qt4_prefix}/qsci/api/python/PyQt4.api
 %endif
 
+%files -n python3-PyQt4
+%defattr(-,root,root,-)
+%doc NEWS README
+%doc OPENSOURCE-NOTICE.TXT
+%doc LICENSE.GPL2 GPL_EXCEPTION*.TXT
+%doc LICENSE.GPL3
+%{python3_sitearch}/PyQt4/
+%exclude %{python3_sitearch}/PyQt4/uic/pyuic.py*
+
+%files -n python3-PyQt4-devel
+%defattr(-,root,root,-)
+%doc doc/*
+%doc examples/
+%{python3_sitearch}/PyQt4/uic/pyuic.py*
+%{_datadir}/python3-sip/PyQt4/
+%if 0%{?fedora}
+%{_qt4_prefix}/qsci/api/python/PyQt4.api
+%endif
+
 
 %changelog
+* Mon Apr 26 2010 David Malcolm <dmalcolm at redhat.com> - 4.7.3-2
+- add python 3 subpackages (#586196)
+
 * Sat Apr 17 2010 Rex Dieter <rdieter at fedoraproject.org> - 4.7.3-1
 - PyQt-x11-gpl-4.7.3
 



More information about the scm-commits mailing list