File python-zdaemon.spec of Package python-zdaemon
#
# spec file for package python-zdaemon
#
# 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/
#
%define modname zdaemon
Name: python-%{modname}
Version: 4.0.0
Release: 0
Summary: Daemon process control library and tools
License: ZPL-2.1
Group: Development/Languages/Python
Url: http://pypi.python.org/pypi/zdaemon
Source: https://pypi.python.org/packages/source/z/zdaemon/%{modname}-%{version}.tar.gz
BuildRequires: python-devel
BuildRequires: python-setuptools
BuildRequires: update-alternatives
Requires(pre): update-alternatives
Requires: python-ZConfig
BuildArch: noarch
%description
zdaemon is a Python package which provides APIs for managing
applications run as daemons. Its principal use to date has been to
manage the application server and storage server daemons for Zope / ZEO,
although it is not limited to running Python-based applications
%prep
%setup -q -n %{modname}-%{version}
sed -i "s|%{modname} =|%{modname}-%{py_ver} =|" setup.py
%build
python setup.py build
%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
# create a dummy target for /etc/alternatives/zdaemon
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
touch %{buildroot}%{_sysconfdir}/alternatives/%{modname}
ln -s -f %{_sysconfdir}/alternatives/%{modname} %{buildroot}/%{_bindir}/%{modname}
%post
update-alternatives \
--install %{_bindir}/%{modname} %{modname} %{_bindir}/%{modname}-%{py_ver} 20
%preun
if [ $1 -eq 0 ] ; then
update-alternatives --remove %{modname} %{_bindir}/%{modname}-%{py_ver}
fi
%files
%defattr(-,root,root)
%doc README.txt CHANGES.txt
%ghost %{_sysconfdir}/alternatives/%{modname}
%{python_sitelib}
%{_bindir}/%{modname}
%{_bindir}/%{modname}-%{py_ver}
%changelog