%global python_ver %(%{__python} -c "import sys ; print sys.version[:3]")
%global python_sitelib  %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")
%global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")

%define _qt4_version %(pkg-config --modversion --silence-errors Qt 2>/dev/null || echo 4.8.6)
%define _qt4_prefix %(pkg-config --variable prefix --silence-errors Qt 2>/dev/null || echo %{_libdir}/qt4)
%define _qt4_plugindir %(pkg-config --variable plugindir --silence-errors Qt 2>/dev/null || echo %{_qt4_prefix}/plugins)
%define qt4qmake %{_qt4_prefix}/bin/qmake

Name: 	 PyQt4
Summary: Python bindings for Qt4
Summary(ja): Qt4 の Python バインディング
Version: 4.11.2
Release: 1%{?_dist_release}

# GPLv2 exceptions(see GPL_EXCEPTIONS*.txt)
License: GPLv3 or GPLv2 with exceptions
Group: 	 System Environment/Libraries
URL:     http://www.riverbankcomputing.com/software/pyqt/

Source0: http://www.riverbankcomputing.com/static/Downloads/PyQt4/PyQt-x11-gpl-%{version}.tar.gz

## upstreamable patches
# fix multilib conflict because of timestamp
Patch50:  PyQt-x11-gpl-4.9.5-timestamp_multilib.patch 
Patch52:  PyQt-x11-gpl-4.10.4-pyuic_shbang.patch

# Vine Patch
Patch100: PyQt-x11-gpl-4.7.3-phononpath_vine.patch

BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: dbus-devel dbus-python-devel
BuildRequires: findutils
BuildRequires: libXext-devel
BuildRequires: phonon-devel
BuildRequires: python-devel
# beware of PyQt4/qscintilla bootstap issues
#BuildRequires: qscintilla
BuildRequires: qt4-devel >= 4.5.0
BuildRequires: qt-assistant-adp-devel
BuildRequires: sip-devel >= 4.13.1
Requires: sip >= 4.13.1
Requires: dbus-python
Requires: qt4

%description
These are Python bindings for Qt4.

%package devel
Summary: Files needed to build other bindings based on Qt4
Group:	 Development/Libraries
Requires: %{name} = %{version}-%{release}
Requires: qt4-devel >= 4.5.0
Requires: qt-assistant-adp-devel
Requires: sip-devel >= 4.13.1

%description devel
Files needed to build other bindings for C++ classes that inherit from any
of the Qt4 classes (e.g. KDE or your own).


%prep
%setup -q -n PyQt-x11-gpl-%{version}
%patch50 -p1 -b .timestamp
# skip -b on this one, so the backup copy doesnt end up packaged too
%patch52 -p1

#patch100 -p1 -b .phononpath_vine 

# permissions, mark examples non-executable
find examples/ -name "*.py" | xargs chmod a-x
chmod a+rx pyuic/uic/pyuic.py

%build
QT4DIR=%{_qt4_prefix}
PATH=%{_qt4_bindir}:$PATH ; export PATH
%{__python} configure.py \
  --assume-shared \
  --confirm-license \
  --no-timestamp \
  --qmake=%{qt4qmake} \
  --no-qsci-api \
  --verbose 

make %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT

make install DESTDIR=$RPM_BUILD_ROOT INSTALL_ROOT=$RPM_BUILD_ROOT

# HACK: fix multilb conflict, http://bugzilla.redhat.com/509415
rm -fv $RPM_BUILD_ROOT%{_bindir}/pyuic4
mv $RPM_BUILD_ROOT%{python_sitearch}/PyQt4/uic/pyuic.py \
   $RPM_BUILD_ROOT%{_bindir}/pyuic4
ln -s %{_bindir}/pyuic4 \
      $RPM_BUILD_ROOT%{python_sitearch}/PyQt4/uic/pyuic.py

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
%doc NEWS README
%doc OPENSOURCE-NOTICE.TXT
%doc LICENSE.GPL2 GPL_EXCEPTION*.TXT
%doc LICENSE.GPL3
%{python_sitearch}/PyQt4/
%exclude %{python_sitearch}/PyQt4/uic/pyuic.py*
# fixme?  -> sitearch?  -- Rex
%{python_sitelib}/dbus/mainloop/qt.so
%{_qt4_plugindir}/designer/*

%files devel
%defattr(-,root,root,-)
%doc doc/*
%doc examples/
%{_bindir}/pylupdate4
%{_bindir}/pyrcc4
%{_bindir}/pyuic4
%{python_sitearch}/PyQt4/uic/pyuic.py*
%{_datadir}/sip/PyQt4/
#{_qt4_prefix}/qsci/api/python/PyQt4.api

%changelog
* Sat Nov  8 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 4.11.2-1
- new upstream release
- added Patch50 and 52
- moved to System Environment/Libraries Group

* Mon May 05 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.10.4-1
- new upstream release
- update Patch1 (PyQt-x11-gpl-4.10.4-64bit.patch)

* Sun Dec 08 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.10.3-1
- new upstream release

* Sat Sep 07 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.10.2-1
- new upstream release

* Wed Jun 05 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.10.1-1
- new upstream release

* Sun Jul 29 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.9.4-1
- new upstream release
- update Patch1 (PyQt-x11-gpl-4.9.4-64bit.patch)

* Sat Feb 18 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.9.0-2
- rebuild with python-2.7.2

* Sat Jan  7 2012 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 4.9.0-1
- new upstream release
- aaded BR: qt-assistant-adp-devel

* Sat Aug 27 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.8.4-2
- update Patch1 (PyQt-x11-gpl-4.8.4-64bit.patch) (x86_64 only)

* Sun Jul 31 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 4.8.4-1
- new upstream release

* Sun Mar 13 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.8.3-4
- re-add Patch1 (PyQt-x11-gpl-4.8.3-64bit.patch) (x86_64 only)
- remove %%sip_ver

* Thu Mar 10 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 4.8.3-3
- rebuilt with qt4-4.7.2

* Tue Feb 01 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.8.3-2
- update Patch1 (PyQt-x11-gpl-4.8.3-64bit.patch)

* Sun Jan 30 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 4.8.3-1
- new upstream release
- built with sip-4.12.1 and qt4-4.7.1

* Wed Aug 25 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.7.4-2
- rebuild with qt4-4.6.3
- fix %qtver (from 4.6.1 to 4.6.3)

* Sun Jul 25 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 4.7.4-1
- new upstream release
- rebuilt with sip-4.10.5 and qt4-4.6.3

* Sun May 09 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 4.7.3-1
- new upstream release
- updated Patch100

* Fri Feb 05 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 4.7-2
- updated Patch100 to build phonon module

* Wed Feb 03 2010 Shu KONNO <owa@bg.wakwak.com> 4.7-1
- new upstream release
- rebuilt with python-2.6.4
- dropt Patch100: PyQt-x11-gpl-4.5.4-vine_phonon.patch

* Fri Oct 23 2009 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 4.6-2
- now BuildRequires sip-devel >= 4.9 (was 4.8.2)

* Thu Oct 22 2009 Shu KONNO <owa@bg.wakwak.com> 4.6-1
- new upstream release
- added BR: libXext-devel

* Sat Aug 29 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 4.5.4-3
- added Patch100 for building phonon modules

* Tue Aug 18 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 4.5.4-2
- Initial build for Vine

* Tue Jul 28 2009 Rex Dieter <rdieter@fedoraproject.org> - 4.5.4-1
- PyQt4-4.5.4

* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.5.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Thu Jul 16 2009 Rex Dieter <rdieter@fedoraproject.org> - 4.5.2-1
- PyQt4-4.5.2

* Thu Jul 02 2009 Rex Dieter <rdieter@fedoraproject.org> - 4.5.1-2
- fix build with qt-4.5.2
- PyQt4-devel multilib conflict (#509415)

* Tue Jun 16 2009 Rex Dieter <rdieter@fedoraproject.org> - 4.5.1-1
- PyQt-4.5.1

* Fri Jun 05 2009 Rex Dieter <rdieter@fedoraproject.org> - 4.5-1
- PyQt-4.5

* Thu May 21 2009 Rex Dieter <rdieter@fedoraproject.org> - 4.5-0.2.20090520
- fix generation of sip_ver

* Thu May 21 2009 Rex Dieter <rdieter@fedoraproject.org> - 4.5-0.1.20090520
- PyQt-4.5-snapshot-20090520

* Sun Apr 26 2009 Rex Dieter <rdieter@fedoraproject.org> - 4.4.4-6
- rebuild for phonon bindings (#497680)

* Thu Mar 05 2009 Rex Dieter <rdieter@fedorproject.org> - 4.4.4-5
- move designer plugins to main/runtime (#487622)

* Mon Feb 23 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.4.4-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Fri Feb 13 2009 Than Ngo <than@redhat.com> - 4.4.4-3
- rebuild against qt-4.5rc1

* Sat Nov 29 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com> - 4.4.4-2
- Rebuild for Python 2.6

* Mon Nov 10 2008 Rex Dieter <rdieter@fedoraproject.org> 4.4.4-1
- PyQt-4.4.4

* Tue Aug 26 2008 Rex Dieter <rdieter@fedoraproject.org> 4.4.3-1
- PyQt-4.4.3

* Sat Jun 14 2008 Rex Dieter <rdieter@fedoraproject.org> 4.4.2-2
- PyQt4 is built without QtWebKit support (#451490)

* Wed May 21 2008 Rex Dieter <rdieter@fedoraproject.org> 4.4.2-1
- PyQt-4.4.2

* Wed May 14 2008 Rex Dieter <rdieter@fedoraproject.org> 4.4-1
- PyQt-4.4
- License: GPLv3 or GPLv2 with exceptions

* Mon Feb 11 2008 Rex Dieter <rdieter@fedoraproject.org> 4.3.3-2 
- respin (gcc43)

* Wed Dec 05 2007 Rex Dieter <rdieter[AT]fedoraproject.org> 4.3.3-1
- PyQt-4.3.3

* Thu Nov 22 2007 Rex Dieter <rdieter[AT]fedoraproject.org> 4.3.1-3
- dbus support (#395741)

* Mon Nov 12 2007 Rex Dieter <rdieter[AT]fedoraproject.org> 4.3.1-1
- PyQt-4.3.1

* Thu Oct 04 2007 Rex Dieter <rdieter[AT]fedoraproject.org> 4.2-8
- drop ExcludeArch: ppc64 , qt4 bug is (hopefully) fixed.

* Thu Oct 04 2007 Rex Dieter <rdieter[AT]fedoraproject.org> 4.2-7
- fix QtDesigner plugin install

* Wed Oct 03 2007 Rex Dieter <rdieter[AT]fedoraproject.org> 4.2-6
- 64bit QtDesigner patch

* Mon Aug 27 2007 Rex Dieter <rdieter[AT]fedoraproject.org> 4.2-5
- -devel: Requires: qt4-devel

* Sun Aug 26 2007 Rex Dieter <rdieter[AT]fedoraproject.org> 4.2-4
- use %%python_sitearch
- License: GPLv2

* Thu Aug 02 2007 Rex Dieter <rdieter[AT]fedoraproject.org> 4.2-3
- fix python_sitelib typo (wrt chrpath call)
- move %%_bindir stuff to -devel
- mark %%doc examples non-executable
- add shebang to %%_bindir/pyuic4

* Tue Jul 17 2007 Rex Dieter <rdieter[AT]fedoraproject.org> 4.2-2
- remove rpath from QtDesigner.so
- BR: qt4-devel > 4.3.0-8

* Wed Apr 11 2007 Rex Dieter <rdieter[AT]fedoraproject.org> 4.2-1
- PyQt4-4.2

* Wed Feb 28 2007 Rex Dieter <rdieter[AT]fedoraproject.org> 4.1.1-2
- fix build against multilib'd qt4

* Mon Dec 11 2006 Rex Dieter <rexdieter[AT]usres.sf.net> 4.1.1-1
- PyQt4-4.1.1
- BR: sip-devel >= 4.5.1

* Mon Nov 06 2006 Rex Dieter <rexdieter[AT]users.sf.net> 4.1-1
- PyQt4-4.1

* Wed Oct 04 2006 Rex Dieter <rexdieter[AT]users.sf.net> 4.0.1-4
- don't own %%_datadir/sip (bug #206633)

* Mon Aug 28 2006 Rex Dieter <rexdieter[AT]users.sf.net> 4.0.1-3
- BR: qt4-devel < 4.2

* Sat Jul 29 2006 Rex Dieter <rexdieter[AT]users.sf.net> 4.0.1-2
- fix reference(s) to qmake(4)

* Sun Jul 16 2006 Rex Dieter <rexdieter[AT]users.sf.net> 4.0.1-1
- PyQt-4.0.1

* Mon Jun 12 2006 Rex Dieter <rexdieter[AT]users.sf.net> 4.0-1
- PyQt-4.0(final)
- BR: sip-devel >= 4.4.4 (see bug #199430)

* Fri May 12 2006 Rex Dieter <rexdieter[AT]users.sf.net> 4.0-0.6.beta1
- drop BR: qt4-MySQL qt4-ODBC qt4-PostgreSQL
- drop usage of (undefined) %%sip_min

* Fri Apr 28 2006 Rex Dieter <rexdieter[AT]users.sf.net> 4.0-0.5.beta1
- cleanup for Extras

* Fri Apr 28 2006 Rex Dieter <rexdieter[AT]users.sf.net> 4.0-0.4.beta1
- 4.0beta1

* Thu Apr 27 2006 Rex Dieter <rexdieter[AT]users.sf.net> 4.0-0.3.20060421 
- respin for sip-4.4.3
- use sip-abi, sip-abi-min

* Mon Apr 24 2006 Rex Dieter <rexdieter[AT]users.sf.net> 4.0-0.2.20060421
- 20060421 snapshot

* Wed Apr 19 2006 Rex Dieter <rexdieter[AT]users.sf.net> 0.0-0.1.20060417
- first try, using 20060417 snapshot

