File python-buildbot-slave.spec of Package python-buildbot-slave

#
# spec file for package python-buildbot-slave
#
# Copyright (c) 2016 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:           python-buildbot-slave
Version:        0.8.12
Release:        0
Summary:        BuildBot Slave Daemon
License:        GPL-2.0
Group:          Development/Languages/Python
Url:            http://buildbot.net/
Source:         https://pypi.python.org/packages/source/b/buildbot-slave/buildbot-slave-%{version}.tar.gz
BuildRequires:  python-devel
BuildRequires:  python-setuptools

Requires:       python-Twisted    >= 9.0.0
Requires:       python-mock
Requires(post): update-alternatives
Requires(postun): update-alternatives

# Debugging with Manhole, interactive Python shell:
Recommends:     python-pycrypto python-pyasn1 >= 0.1.2

%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
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Buildbot is a continuous integration system designed to automate the
build/test cycle. By automatically rebuilding and testing the tree each time
something has changed, build problems are pinpointed quickly, before other
developers are inconvenienced by the failure.  

This package contains only the buildslave implementation.  The buildbot 
package contains the buildmaster as well as a complete set of documentation.



%prep
%setup -q -n buildbot-slave-%{version}

# Add Interpreter version suffix to entrypoints (and thus /usr/bin binaries) to
# allow for update-alternatives later on:
sed -i "s|\[\"\(bin/buildslave\)|\[\"\1-%{py_ver}|" setup.py # Add Python version suffix to binaries 

mv bin/buildslave bin/buildslave-%{py_ver}

%build
python setup.py build

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

### Create links
ln -s %{_bindir}/buildslave-%{py_ver} %{buildroot}%{_bindir}/buildslave

### Handle man page
mkdir -p %{buildroot}%{_mandir}/man1
install -m 644 docs/buildslave.1 %{buildroot}%{_mandir}/man1/buildslave-%{py_ver}.1
ln -s %{_mandir}/man1/buildslave-%{py_ver}.1 %{buildroot}%{_mandir}/man1/buildslave.1

%pre
# Since /usr/bin/buildbot* became ghosted to be used with update-alternatives, we have
# to get rid of the old binary resulting from the non-update-alternativies-ified package:
[[ ! -L %{_bindir}/buildslave ]] && rm -f %{_bindir}/buildslave
[[ ! -L %{_mandir}/man1/buildslave.1%{ext_man} ]] && rm -f %{_mandir}/man1/buildslave.1%{ext_man}

%post
update-alternatives \
    --install %{_bindir}/buildslave buildslave %{_bindir}/buildslave-%{py_ver} 20 \
    --slave %{_mandir}/man1/buildslave.1%{ext_man} buildslave.1 %{_mandir}/buildslave-%{py_ver}.1%{ext_man}

%preun
if [ $1 -eq 0 ] ; then
    update-alternatives --remove buildslave %{_bindir}/buildslave-%{py_ver}
fi

%files
%defattr(-,root,root,-)
%doc COPYING README NEWS

%ghost %{_bindir}/buildslave
%{_bindir}/buildslave-%{py_ver}

%ghost %{_mandir}/man1/buildslave.1%{ext_man}
%{_mandir}/man1/buildslave-%{py_ver}.1%{ext_man}

%{python_sitelib}/*

%if 0%{?suse_version} >= 1230
%ghost %{_sysconfdir}/alternatives/buildslave
%ghost %{_sysconfdir}/alternatives/buildslave.1%{ext_man}
%endif

%changelog
openSUSE Build Service is sponsored by