File python-buildbot.spec of Package python-buildbot

#
# spec file for package python-buildbot
#
# 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
Version:        0.8.12
Release:        0
Summary:        BuildBot Build Automation System
License:        GPL-2.0
Group:          Development/Languages/Python
Url:            http://buildbot.net/
Source:         https://pypi.python.org/packages/source/b/buildbot/buildbot-%{version}.tar.gz
#
BuildRequires:  dos2unix
BuildRequires:  python-Sphinx
BuildRequires:  python-devel
BuildRequires:  python-setuptools

# Contains TwistedMail, Twisted-Web, TwistedWords, TwistedConch
Requires:       python-Jinja2     >= 2.1
Requires:       python-SQLAlchemy >= 0.6.0
Requires:       python-Twisted    >= 9.0.0
Requires:       python-setuptools
Requires:       sqlite3           >= 3.4.0
# python-sqlalchemy-migrate: 0.6.1, 0.7.0, and 0.7.1
Requires:       python-dateutil    >= 1.5
Requires:       python-sqlalchemy-migrate >= 0.6.1
Requires(post): update-alternatives
Requires(postun): update-alternatives

# Only needed for Python 2.5 and earlier:
## Requires:       python-pysqlite
## Requires:       python3-simplejson

%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.  

Features

* Buildbot is easy to set up, but very extensible and customizable.  It
  supports arbitrary build processes, and is not limited to common build
  processes for particular languages (e.g., autotools or ant)

* Buildbot supports building and testing on a variety of platforms.
  Developers, who do not have the facilities to test their changes everywhere
  before committing, will know shortly afterwards whether they have broken the
  build or not.

* Buildbot has minimal requirements for slaves: using virtualenv, only a
  Python installation is required.

* Slaves can be run behind a NAT firewall and communicate with the master

* Buildbot has a variety of status-reporting tools to get information about
  builds in front of developers in a timely manner.


%package doc
Summary:        Documentation for %{name}
Group:          Development/Libraries/Python

%description doc
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 is the documentation for Buildbot.


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

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

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

%build
python setup.py build
touch docs/conf.py docs/index.rst
python setup.py build_sphinx

%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot} --install-data=%{_defaultdocdir}/%{name}

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

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

### Build HTML documentation
[[ -e %{buildroot}%{_defaultdocdir}/%{name} ]] || mkdir -vp %{buildroot}%{_defaultdocdir}/%{name}

### Fix line endings:
dos2unix build/sphinx/html/_static/jquery.js

mkdir -vp %{buildroot}%{_defaultdocdir}/%{name}/html
cp -r build/sphinx/html/*   %{buildroot}%{_defaultdocdir}/%{name}/html

### Copy doc files manually as otherwise it gives problems with excludes and html directory
cp COPYING README NEWS %{buildroot}%{_defaultdocdir}/%{name}

%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}/buildbot ]] && rm -f %{_bindir}/buildbot
[[ ! -L %{_mandir}/man1/buildbot.1%{ext_man} ]] && rm -f %{_mandir}/man1/buildbot.1%{ext_man}
exit 0

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

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

%files
%defattr(-,root,root,-)
# Explicitly not use %%doc/%%exclude as we need the html subdirectory in the
# doc subpackage
%dir %{_defaultdocdir}/%{name}
%{_defaultdocdir}/%{name}/COPYING
%{_defaultdocdir}/%{name}/README
%{_defaultdocdir}/%{name}/NEWS

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

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

%{python_sitelib}/*

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

%files doc
%defattr(-,root,root)
%dir %{_defaultdocdir}/%{name}/html
%{_defaultdocdir}/%{name}/html

%changelog
openSUSE Build Service is sponsored by