File python-invoke.spec of Package python-invoke

#
# spec file for package python-invoke
#
# 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-invoke
Version:        0.9.0
Release:        0
Summary:        Pythonic Task Execution
License:        BSD-2-Clause
Group:          Development/Languages/Python
Url:            http://docs.pyinvoke.org
Source:         https://pypi.python.org/packages/source/i/invoke/invoke-%{version}.tar.gz
BuildRequires:  python-devel
BuildRequires:  python-setuptools
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()")}
%else
BuildArch:      noarch
%endif

%description
Invoke is a Python (2.6+ and 3.2+) task execution tool & library, drawing 
inspiration from various sources to arrive at a powerful & clean feature set.

* Like Ruby's Rake tool and Invoke's own predecessor Fabric 1.x, it provides a
  clean, high level API for running shell commands and defining/organizing
  task functions from a ``tasks.py`` file
  
* From GNU Make, it inherits an emphasis on minimal boilerplate for common
  patterns and the ability to run multiple tasks in a single invocation::

    $ invoke clean build

* Following the lead of most Unix CLI applications, it offers a traditional
  flag-based style of command-line parsing, deriving flag names and value types
  from task signatures (optionally, of course!)::

    $ invoke clean --docs --bytecode build --docs --extra='**/*.pyo'
    $ invoke clean -d -b build --docs -e '**/*.pyo'
    $ invoke clean -db build -de '**/*.pyo'

* Like many of its predecessors, it offers advanced features as well --
  namespacing, task aliasing, before/after hooks, parallel execution and more.



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

%build
python setup.py build

%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
mv %{buildroot}%{_bindir}/inv %{buildroot}%{_bindir}/inv-%{py_ver}
mv %{buildroot}%{_bindir}/invoke %{buildroot}%{_bindir}/invoke-%{py_ver}
ln -s  %{_bindir}/inv-%{py_ver} %{buildroot}%{_bindir}/inv
ln -s  %{_bindir}/invoke-%{py_ver} %{buildroot}%{_bindir}/invoke

%pre -p /bin/bash
# Since /usr/bin/* 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}/inv ]] && rm -f %{_bindir}/inv
[[ ! -L %{_bindir}/invoke ]] && rm -f %{_bindir}/invoke
exit 0

%post
update-alternatives \
   --install %{_bindir}/invoke invoke %{_bindir}/invoke-%{py_ver} 30 \
   --slave %{_bindir}/inv inv %{_bindir}/inv%{py_ver} \

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

%files
%defattr(-,root,root,-)
%doc LICENSE README.rst
%{_bindir}/inv-%{py_ver}
%{_bindir}/invoke-%{py_ver}
%ghost %{_bindir}/inv
%ghost %{_bindir}/invoke
%{python_sitelib}/*

%changelog
openSUSE Build Service is sponsored by