File trytond.spec of Package trytond.7144

#
# spec file for package trytond
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2016 Dr. Axel Braun
#
# 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 majorver 3.8
%define base_name tryton
Name:           trytond
Version:        %{majorver}.14
Release:        0
Summary:        An Enterprise Resource Planning system
License:        GPL-3.0+
Group:          Productivity/Office/Management
Url:            http://www.tryton.org/
Source0:        http://downloads.tryton.org/%{majorver}/%{name}-%{version}.tar.gz
Source1:        tryton-server.README.SUSE
Source2:        trytond.conf.example
Source3:        %{name}.conf
Source4:        %{name}_log.conf
#Source11:       %{name}.sysconfig
Source20:       %{name}.service
Patch0:         %{name}_server.diff
# List of additional build dependencies
BuildRequires:  fdupes
BuildRequires:  python-devel
BuildRequires:  python-lxml
BuildRequires:  python-psycopg2
BuildRequires:  python-pydot
BuildRequires:  python-python-sql
BuildRequires:  python-setuptools
BuildRequires:  python-simplejson
BuildRequires:  systemd-rpm-macros
Requires:       libreoffice-pyuno
Requires:       postgresql-server
Requires:       python-Genshi
Requires:       python-Levenshtein
Requires:       python-PyWebDAV
Requires:       python-Sphinx
Requires:       python-cdecimal
Requires:       python-lxml
Requires:       python-mock
Requires:       python-polib
Requires:       python-psycopg2
Requires:       python-py-bcrypt
#Requires:	python-pytz
#Requires:	python-pyOpenSSL
#Requires:	python-egenix-mx-base
Requires:       python-python-dateutil
Requires:       python-python-sql
Requires:       python-relatorio
Requires:       unoconv
Requires(pre):  %{_sbindir}/groupadd
Requires(pre):  %{_sbindir}/useradd
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
%{?systemd_requires}

%description
This package contains the server of the Tryton application platform,
the latter of which is a three-tier high-level general purpose
application platform written in Python, using Postgresql as the
database engine. Tryton provides modularity, scalability and
security.

%prep
%setup -q
cp %{SOURCE1} .
cp %{SOURCE2} .

%build
python setup.py build

%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot} --record-rpm=filelist
# only for systemd
mkdir -p %{buildroot}%{_sysconfdir}/%{base_name}
install -p -m 640 %{SOURCE3} %{buildroot}%{_sysconfdir}/%{base_name}/%{name}.conf
install -p -m 640 %{SOURCE4} %{buildroot}%{_sysconfdir}/%{base_name}/%{name}_log.conf

mkdir -p %{buildroot}%{_unitdir}
install -p -m 644 %{SOURCE20} %{buildroot}%{_unitdir}/%{name}.service

mkdir -p %{buildroot}%{_localstatedir}/{lib,log}/%{base_name}
%fdupes -s %{buildroot}

%pre
getent group tryton > /dev/null || %{_sbindir}/groupadd -r tryton || :
getent passwd tryton > /dev/null || %{_sbindir}/useradd -r -g tryton \
       -d %{_localstatedir}/lib/%{name} -s /sbin/nologin \
	-c 'Tryton ERP' tryton || :
%service_add_pre trytond.service

%post
%service_add_post trytond.service

%preun
%service_del_preun trytond.service

%postun
%service_del_postun trytond.service

%files
%defattr(-,root,root)
%doc README tryton-server.README.SUSE trytond.conf.example LICENSE doc/*
%{python_sitelib}/*
%dir %{_sysconfdir}/%{base_name}
%{_bindir}/%{name}
%{_unitdir}/%{name}.service
%attr(640,root,tryton) %config(noreplace)%{_sysconfdir}/%{base_name}/%{name}.conf
%attr(640,root,tryton) %config(noreplace)%{_sysconfdir}/%{base_name}/%{name}_log.conf
%attr(755,tryton,tryton) %dir %{_localstatedir}/lib/%{base_name}
%attr(755,tryton,tryton) %dir %{_localstatedir}/log/%{base_name}

%changelog
openSUSE Build Service is sponsored by