File python-robotframework.spec of Package python-robotframework

# spec file for package python-robotframework
# 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

%define module robotframework

Name:           python-robotframework
Version:        2.8.6b1
Release:        0
License:        Apache-2.0
Summary:        A generic test automation framework
Group:          Development/Languages/Python
BuildRequires:  python-devel
BuildRequires:  python-setuptools
BuildRequires:  python-nose
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%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()")}
BuildArch:      noarch

Robot Framework is a generic test automation framework for acceptance testing 
and acceptance test-driven development (ATDD).

It has easy-to-use tabular test data syntax and it utilizes the keyword-driven
testing approach. Its testing capabilities can be extended by test libraries
implemented either with Python or Java, and users can create new higher-level
keywords from existing ones using the same syntax that is used for creating
test cases.

Robot Framework is operating system and application independent. The core
framework is implemented using `Python <>`__ and runs also on
`Jython <>`__ (JVM) and `IronPython <>`__
(.NET). The framework has a rich ecosystem around it consisting of various
generic test libraries and tools that are developed as separate projects.
For more information about Robot Framework and the ecosystem, see

%setup -q -n %{module}-%{version}
# Prepare correct script name:
mv src/bin/pybot src/bin/pybot-%{py_ver}
mv src/bin/rebot src/bin/rebot-%{py_ver}

# Add py_ver suffix to binary:
sed -i -r "s/(pybot|rebot)/\1-%{py_ver}/"

# Remove shebang line:
x=$(find src/robot/ -type f -name \*.py | xargs grep "^#\!/" | cut -d: -f1 | tr "\n" " " )
sed -i "1d" $x

python build

python install --prefix=%{_prefix} --root=%{buildroot}

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

# Since /usr/bin/*bot 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}/pybot ]] && rm -f %{_bindir}/pybot
[[ ! -L %{_bindir}/rebot ]] && rm -f %{_bindir}/rebot
exit 0

update-alternatives --install %{_bindir}/pybot pybot %{_bindir}/pybot-%{py_ver} 20
update-alternatives --install %{_bindir}/rebot rebot %{_bindir}/rebot-%{py_ver} 20

if [ $1 -eq 0 ] ; then
    update-alternatives --remove pybot %{_bindir}/pybot-%{py_ver}
    update-alternatives --remove pybot %{_bindir}/rebot-%{py_ver}

# nosetests
exit 0

%if 0%{?suse_version} >= 1230
%ghost %{_bindir}/pybot
%ghost %{_bindir}/rebot