File python-veusz.spec of Package python-veusz
#
# spec file for package python-veusz
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# 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.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%define pyname veusz
Name: python-%{pyname}
Version: 1.13
Release: 1
# The entire source code is GPLv2+ except helpers/src/_nc_cntr.c which is Python
License: GPLv2+ and Python
Summary: GUI scientific plotting package
Url: http://home.gna.org/veusz/
Group: Productivity/Scientific/Other
Source0: veusz-%{version}.tar.bz2
Source1: %{pyname}.desktop
Source2: %{pyname}.xml
BuildRequires: desktop-file-utils
BuildRequires: fdupes
BuildRequires: libqt4-devel
BuildRequires: python-devel
BuildRequires: python-numpy-devel
BuildRequires: python-qt4-devel
BuildRequires: python-setuptools
BuildRequires: python-sip
BuildRequires: update-desktop-files
Requires: python-numpy
Requires: python-qt4
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Requires(post): shared-mime-info desktop-file-utils
Requires(postun): shared-mime-info desktop-file-utils
%{py_requires}
%description
Veusz is a scientific plotting package, designed to create
publication-ready Postscript/PDF/SVG output. It features GUI,
command-line, and scripting interfaces. Graphs are constructed from
widgets, allowing complex layouts to be designed. Veusz supports
plotting functions, data with errors, keys, labels, stacked plots,
multiple plots, contours, shapes and fitting data.
%prep
%setup -q -n %{pyname}-%{version}
find -name \*~ | xargs rm -f
# change path of where to lookup bitmaps
# this is so we can move the icons out of the python directory
# and into /usr/share/pixmaps/veusz
sed -i "/imagedir =/c\\imagedir = '%{_datadir}/pixmaps/veusz'" \
${RPM_BUILD_DIR}/veusz-%{version}/utils/action.py
# change path of where to look for COPYING - should be docdir
sed -i "/f =/s+utils.veuszDirectory+'%{_docdir}/%{name}'+" \
${RPM_BUILD_DIR}/veusz-%{version}/dialogs/aboutdialog.py
%build
CFLAGS="%{optflags}"
python setup.py build
%install
python setup.py install -O1 --skip-build --prefix="%{_prefix}" \
--root=%{buildroot}
# install desktop file
%suse_update_desktop_file -i veusz
# file to register .vsz mimetype
mkdir -p %{buildroot}%{_datadir}/mime/packages/
cp %{SOURCE2} %{buildroot}%{_datadir}/mime/packages/
# move icon files to /usr/share/pixmaps/veusz
# symlink main veusz icon also into pixmaps (for desktop file)
mkdir -p %{buildroot}%{_datadir}/pixmaps/veusz
mv %{buildroot}%{python_sitearch}/veusz/windows/icons/*.png \
%{buildroot}%{_datadir}/pixmaps/veusz
mv %{buildroot}%{python_sitearch}/veusz/windows/icons/*.svg \
%{buildroot}%{_datadir}/pixmaps/veusz
ln -s veusz/veusz_48.png %{buildroot}%{_datadir}/pixmaps/veusz.png
# Mark some scripts as executable.
# This isn't really needed, but Veusz includes shebangs in scripts
# so that they can be run when not installed.
# Do this so that the scripts don't need modification.
chmod +x %{buildroot}%{python_sitearch}/veusz/veusz_main.py
chmod +x %{buildroot}%{python_sitearch}/veusz/veusz_listen.py
# install man pages
mkdir -p %{buildroot}%{_mandir}/man1
install -p Documents/veusz.1 Documents/veusz_listen.1 -m 0644 \
%{buildroot}%{_mandir}/man1
%fdupes -s %{buildroot}%{py_sitedir}
%fdupes %{buildroot}%{_datadir}/pixmaps/%{pyname}/
%post
update-mime-database %{_datadir}/mime > /dev/null 2>&1 || :
update-desktop-database %{_datadir}/applications
%postun
update-mime-database %{_datadir}/mime > /dev/null 2>&1 || :
update-desktop-database %{_datadir}/applications
%clean
%{?buildroot:rm -rf %{buildroot}}
%files
%defattr(-,root,root)
%doc README AUTHORS COPYING ChangeLog
%doc examples/
%doc Documents/manual.html
%doc Documents/manimages/
%{_bindir}/veusz
%{_bindir}/veusz_listen
%{_datadir}/applications/%{pyname}.desktop
%{_datadir}/mime/packages/%{pyname}.xml
%{python_sitearch}/%{pyname}-%{version}-py%{py_ver}.egg-info
%{python_sitearch}/%{pyname}/
%{_datadir}/pixmaps/%{pyname}/
%{_datadir}/pixmaps/%{pyname}.png
%{_mandir}/man1/*
%changelog