File OpenLP.spec of Package OpenLP

#
# spec file for package OpenLP
#
# Copyright (c) 2014 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/
#


Name:           OpenLP
Version:        2.0.5
Release:        0
Summary:        Open source Church presentation and lyrics projection application
License:        GPL-2.0
Group:          Productivity/Multimedia/Other
Url:            http://openlp.org
Source0:        http://downloads.sourceforge.net/openlp/openlp/%{version}/%{name}-%{version}.tar.gz
Source1:        OpenLP-rpmlintrc

BuildRequires:  desktop-file-utils
BuildRequires:  fdupes
BuildRequires:  libqt4-devel
BuildRequires:  python-devel
BuildRequires:  python-setuptools
BuildRequires:  update-desktop-files
Requires:       hicolor-icon-theme
Requires:       libphonon4
Requires:       python-Mako
Requires:       python-SQLAlchemy
Requires:       python-beautifulsoup
Requires:       python-chardet
Requires:       python-lxml
Requires:       python-pyenchant
Requires:       python-qt4
Requires:       python-sqlalchemy-migrate
Requires:       python-xdg
Recommends:     libreoffice-pyuno
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires(post): shared-mime-info
Requires(postun): shared-mime-info
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%else
BuildArch:      noarch
%endif

%description
OpenLP is a church presentation software, for lyrics projection software,
used to display slides of Songs, Bible verses, videos, images, and
presentations via LibreOffice using a computer and projector.

%prep
%setup -q
# Needed to prevent /usr/lib/python2.7/site-packages/resources from being built
rm resources/__init__.py

%build
python setup.py build

# Compile the translation files and copy them to the correct directory
# Presumes you are in the base directory of OpenLP

%install
python setup.py install --skip-build -O1 --prefix=%{_prefix} --root=%{buildroot}

install -m644 -p -D resources/images/openlp-logo-16x16.png %{buildroot}%{_datadir}/icons/hicolor/16x16/apps/openlp.png
install -m644 -p -D resources/images/openlp-logo-32x32.png %{buildroot}%{_datadir}/icons/hicolor/32x32/apps/openlp.png
install -m644 -p -D resources/images/openlp-logo-48x48.png %{buildroot}%{_datadir}/icons/hicolor/48x48/apps/openlp.png
install -m644 -p -D resources/images/openlp-logo.svg %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/openlp.svg

%suse_update_desktop_file -i -r openlp AudioVideo Video Player

mv %{buildroot}%{_bindir}/openlp.pyw %{buildroot}%{_bindir}/openlp

mkdir -p %{buildroot}%{_datadir}/openlp/i18n/
for TSFILE in resources/i18n/*.ts; do
    lrelease $TSFILE -qm %{buildroot}%{_datadir}/openlp/i18n/`basename $TSFILE .ts`.qm;
done

mkdir -p %{buildroot}%{_datadir}/mime/packages
cp -p resources/openlp.xml %{buildroot}%{_datadir}/mime/packages

# Deduplicate .pyc and .pyo files
%fdupes %{buildroot}%{python_sitelib}

%post
touch --no-create %{_datadir}/icons/hicolor ||:
gtk-update-icon-cache -q %{_datadir}/icons/hicolor 2> /dev/null ||:
update-mime-database %{_datadir}/mime > /dev/null 2>&1 ||:
update-desktop-database > /dev/null 2>&1 ||:

%postun
touch --no-create %{_datadir}/icons/hicolor ||:
gtk-update-icon-cache -q %{_datadir}/icons/hicolor 2> /dev/null ||:
update-mime-database %{_datadir}/mime > /dev/null 2>&1 ||:
update-desktop-database > /dev/null 2>&1 ||:

%files
%defattr(-,root,root)
%doc copyright.txt LICENSE
%{_bindir}/openlp
%{_datadir}/mime/packages/openlp.xml
%{_datadir}/applications/openlp.desktop
%{_datadir}/icons/hicolor
%{_datadir}/openlp
%{python_sitelib}/openlp/
%{python_sitelib}/%{name}-%{version}*.egg-info

%changelog
openSUSE Build Service is sponsored by