File supervisor.spec of Package supervisor

#
# spec file for package supervisor
#
# Copyright (c) 2018 SUSE LINUX 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:           supervisor
Version:        3.3.3
Release:        0
Url:            http://supervisord.org/
Summary:        A system for controlling process state under UNIX
License:        SUSE-Repoze
Group:          Development/Languages/Python
Source:         https://files.pythonhosted.org/packages/source/s/%{name}/%{name}-%{version}%{?prever}.tar.gz
Source1:        supervisord.init
Source2:        supervisord.conf
Source3:        supervisord.service
Source4:        supervisord.tmpfile
Patch:          interpreter.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  python-devel
BuildRequires:  python-rpm-macros
BuildRequires:  python-setuptools
%if 0%{?suse_version} >= 1230
%{?systemd_requires}
%else
Requires(pre): %insserv_prereq
%endif
Requires:       python-meld3
Requires:       python-setuptools
Requires:       python-xml

BuildArch:      noarch

%description
Supervisor is a client/server system that allows its users to
control a number of processes on UNIX-like operating systems.

%prep
%setup -q -n supervisor-%{version}

%build
%py2_build

%install
%py2_install
%{__rm} -rf %{buildroot}%{python_sitelib}/supervisor/tests
%{__install} -d %{buildroot}%{_sbindir}
%{__install} -d %{buildroot}%{_sysconfdir}
%{__install} -d %{buildroot}%{_sysconfdir}/supervisord.d
%if 0%{?suse_version} >= 1230
%{__install} -D -m 755 %{SOURCE4} %{buildroot}%{_prefix}/lib/tmpfiles.d/supervisord.conf
%{__install} -D -m 755 %{SOURCE3} %{buildroot}%{_unitdir}/supervisord.service
%{__ln_s} -f /sbin/service %{buildroot}%{_sbindir}/rcsupervisord
%else
%{__install} -D -m 755 %{SOURCE1} %{buildroot}%{_sysconfdir}/init.d/supervisord
%{__ln_s} -f %{_sysconfdir}/init.d/supervisord %{buildroot}%{_sbindir}/rcsupervisord
# Socket and PID dir
%{__install} -d -m 700 %{buildroot}%{_localstatedir}/run/supervisord/
%endif
# Logs dir.
%{__install} -d -m 750 %{buildroot}%{_localstatedir}/log/supervisord/
%{__install} -m 660 %{S:2} %{buildroot}%{_sysconfdir}/

%if 0%{?suse_version} >= 1230
%pre
%service_add_pre supervisord.service
%endif

%post
%if 0%{?suse_version} >= 1230
%service_add_post supervisord.service
%else
%fillup_and_insserv supervisord
%endif

%preun
%if 0%{?suse_version} >= 1230
%service_del_preun supervisord.service
%else
%stop_on_removal supervisord
%endif

%postun
%if 0%{?suse_version} >= 1230
%service_del_postun supervisord.service
%else
%insserv_cleanup
%restart_on_update supervisord
%endif

%files
%defattr(-,root,root,-)
%doc README.rst CHANGES.txt LICENSES.txt COPYRIGHT.txt
%{python_sitelib}/*
%{_bindir}/echo_supervisord_conf
%{_bindir}/pidproxy
%{_bindir}/supervisorctl
%{_bindir}/supervisord
%{_sbindir}/rcsupervisord
%if 0%{?suse_version} >= 1230
%{_prefix}/lib/tmpfiles.d/supervisord.conf
%{_unitdir}/supervisord.service
%else
%{_sysconfdir}/init.d/supervisord
%dir %attr(700,root,root)%{_localstatedir}/run/supervisord
%endif
%config(noreplace) %{_sysconfdir}/supervisord.conf
%dir %{_sysconfdir}/supervisord.d
%dir %attr(750,root,root)%{_localstatedir}/log/supervisord

%changelog
openSUSE Build Service is sponsored by