From f2d3f53a8d369dbea91f0cc72c1597ffa0996a5c Mon Sep 17 00:00:00 2001 From: pcpa Date: Tue, 4 Dec 2012 23:31:08 -0200 Subject: [PATCH] Correct wrong dependency of main package on the tk backend. - Reinstantiate wx backend for python2.x. - Run setup.py under xvfb-run to detect and default to gtk backend (#883502) - Split qt4 backend subpackage and add proper requires for it. - Correct wrong regex in tcl libdir patch. --- python-matplotlib-tk.patch | 2 +- python-matplotlib.spec | 69 ++++++++++++++++++++++++++++++++++---- 2 files changed, 63 insertions(+), 8 deletions(-) diff --git a/python-matplotlib-tk.patch b/python-matplotlib-tk.patch index 1048019..1a07f53 100644 --- a/python-matplotlib-tk.patch +++ b/python-matplotlib-tk.patch @@ -8,7 +8,7 @@ diff -up matplotlib-1.2.0/setupext.py.orig matplotlib-1.2.0/setupext.py - "/usr/lib/tcl"+str(Tkinter.TclVersion), - "/usr/lib"] + "@@libdir@@/tcl"+str(Tkinter.TclVersion), -+ "@@lib@@"] ++ "@@libdir@@"] tk_poss = [tk_lib_dir, os.path.normpath(os.path.join(tk_lib_dir, '..')), - "/usr/lib/tk"+str(Tkinter.TkVersion), diff --git a/python-matplotlib.spec b/python-matplotlib.spec index a1698a4..cd15932 100644 --- a/python-matplotlib.spec +++ b/python-matplotlib.spec @@ -9,7 +9,7 @@ Name: python-matplotlib Version: 1.2.0 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Python 2D plotting library Group: Development/Libraries License: Python @@ -29,19 +29,21 @@ BuildRequires: gtk2-devel BuildRequires: libpng-devel BuildRequires: numpy BuildRequires: pycairo-devel +BuildRequires: pygtk2-devel BuildRequires: pyparsing BuildRequires: python-dateutil BuildRequires: python2-devel BuildRequires: pytz +BuildRequires: xorg-x11-server-Xvfb BuildRequires: zlib-devel Requires: dejavu-sans-fonts Requires: dvipng Requires: numpy Requires: pycairo +Requires: pygtk2 Requires: pyparsing Requires: python-dateutil Requires: pytz -Obsoletes: %{name}-wx < %{version}-%{release} %description Matplotlib is a python 2D plotting library which produces publication @@ -54,6 +56,16 @@ Matplotlib tries to make easy things easy and hard things possible. You can generate plots, histograms, power spectra, bar charts, errorcharts, scatterplots, etc, with just a few lines of code. +%package qt4 +Summary: Qt4 backend for python-matplotlib +Group: Development/Libraries +Requires: %{name}%{?_isa} = %{version}-%{release} +BuildRequires: PyQt4-devel +Requires: PyQt4 + +%description qt4 +%{summary} + %package tk Summary: Tk backend for python-matplotlib Group: Development/Libraries @@ -66,6 +78,16 @@ Requires: tkinter %description tk %{summary} +%package wx +Summary: wxPython backend for python-matplotlib +Group: Development/Libraries +Requires: %{name}%{?_isa} = %{version}-%{release} +BuildRequires: wxPython-devel +Requires: wxPython + +%description wx +%{summary} + %package doc Summary: Documentation files for python-matplotlib Group: Documentation @@ -108,6 +130,16 @@ Matplotlib tries to make easy things easy and hard things possible. You can generate plots, histograms, power spectra, bar charts, errorcharts, scatterplots, etc, with just a few lines of code. +%package -n python3-matplotlib-qt4 +Summary: Qt4 backend for python3-matplotlib +Group: Development/Libraries +Requires: %{name}%{?_isa} = %{version}-%{release} +BuildRequires: python3-PyQt4-devel +Requires: python3-PyQt4 + +%description -n python3-matplotlib-qt4 +%{summary} + %package -n python3-matplotlib-tk Summary: Tk backend for python3-matplotlib Group: Development/Libraries @@ -131,7 +163,7 @@ sed -i -e s/matplotlib\.pyparsing_py./pyparsing/g lib/matplotlib/*.py # Correct tcl/tk detection %patch1 -p1 -b .tk -sed -i -e 's|@@@libdir@@@|%{_libdir}|' setupext.py +sed -i -e 's|@@libdir@@|%{_libdir}|' setupext.py chmod -x lib/matplotlib/mpl-data/images/*.svg @@ -141,7 +173,7 @@ cp -a . %{py3dir} %endif %build -%{__python2} setup.py build +xvfb-run %{__python2} setup.py build %if %{with_html} # Need to make built matplotlib libs available for the sphinx extensions: pushd doc @@ -155,20 +187,20 @@ find examples -name '*.py' -exec chmod a-x '{}' \; %if %{with_python3} pushd %{py3dir} - %{__python3} setup.py build + xvfb-run %{__python3} setup.py build # documentation cannot be built with python3 due to syntax errors # and building with python 2 exits with cryptic error messages popd %endif %install -%{__python} setup.py install -O1 --skip-build --root=$RPM_BUILD_ROOT +xvfb-run %{__python} setup.py install -O1 --skip-build --root=$RPM_BUILD_ROOT chmod +x $RPM_BUILD_ROOT%{python_sitearch}/matplotlib/dates.py rm -rf $RPM_BUILD_ROOT%{python_sitearch}/matplotlib/mpl-data/fonts %if %{with_python3} pushd %{py3dir} - %{__python3} setup.py install -O1 --skip-build --root=$RPM_BUILD_ROOT + xvfb-run %{__python3} setup.py install -O1 --skip-build --root=$RPM_BUILD_ROOT chmod +x $RPM_BUILD_ROOT%{python3_sitearch}/matplotlib/dates.py rm -rf $RPM_BUILD_ROOT%{python3_sitearch}/matplotlib/mpl-data/fonts rm -f $RPM_BUILD_ROOT%{python3_sitearch}/six.py @@ -189,17 +221,27 @@ popd %{python_sitearch}/matplotlib/ %{python_sitearch}/mpl_toolkits/ %{python_sitearch}/pylab.py* +%exclude %{python_sitearch}/matplotlib/backends/backend_qt4.* +%exclude %{python_sitearch}/matplotlib/backends/backend_qt4agg.* %exclude %{python_sitearch}/matplotlib/backends/backend_tkagg.* %exclude %{python_sitearch}/matplotlib/backends/tkagg.* %exclude %{python_sitearch}/matplotlib/backends/_tkagg.so %exclude %{python_sitearch}/matplotlib/backends/backend_wx.* %exclude %{python_sitearch}/matplotlib/backends/backend_wxagg.* +%files qt4 +%{python_sitearch}/matplotlib/backends/backend_qt4.* +%{python_sitearch}/matplotlib/backends/backend_qt4agg.* + %files tk %{python_sitearch}/matplotlib/backends/backend_tkagg.py* %{python_sitearch}/matplotlib/backends/tkagg.py* %{python_sitearch}/matplotlib/backends/_tkagg.so +%files wx +%{python_sitearch}/matplotlib/backends/backend_wx.* +%{python_sitearch}/matplotlib/backends/backend_wxagg.* + %files doc %doc examples %if %{with_html} @@ -222,10 +264,17 @@ popd %{python3_sitearch}/mpl_toolkits/ %{python3_sitearch}/pylab.py* %{python3_sitearch}/__pycache__/* +%exclude %{python3_sitearch}/matplotlib/backends/backend_qt4.* +%exclude %{python3_sitearch}/matplotlib/backends/backend_qt4agg.* +%exclude %{python3_sitearch}/matplotlib/backends/backend_tkagg.* %exclude %{python3_sitearch}/matplotlib/backends/backend_tkagg.* %exclude %{python3_sitearch}/matplotlib/backends/tkagg.* %exclude %{python3_sitearch}/matplotlib/backends/_tkagg.* +%files -n python3-matplotlib-qt4 +%{python_sitearch}/matplotlib/backends/backend_qt4.* +%{python_sitearch}/matplotlib/backends/backend_qt4agg.* + %files -n python3-matplotlib-tk %{python3_sitearch}/matplotlib/backends/backend_tkagg.py* %{python3_sitearch}/matplotlib/backends/tkagg.* @@ -233,6 +282,12 @@ popd %endif %changelog +* Tue Dec 04 2012 pcpa - 1.2.0-5 +- Reinstantiate wx backend for python2.x. +- Run setup.py under xvfb-run to detect and default to gtk backend (#883502) +- Split qt4 backend subpackage and add proper requires for it. +- Correct wrong regex in tcl libdir patch. + * Tue Nov 27 2012 pcpa - 1.2.0-4 - Obsolete python-matplotlib-wx for clean updates.