File python-parallax.spec of Package python-parallax

#
# spec file for package python-parallax
#
# 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-parallax
Version:        1.0.1
Release:        0
Summary:        Execute commands and copy files over SSH to multiple machines at once
License:        BSD-3-Clause
Group:          Development/Languages/Python
Url:            https://github.com/krig/parallax/
Source:         https://pypi.python.org/packages/source/p/parallax/parallax-%{version}.tar.gz
BuildRequires:  python-devel
BuildRequires:  python-setuptools
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires:       openssh
BuildArch:      noarch
%if 0%{?suse_version}
Requires(post):   update-alternatives
Requires(postun): update-alternatives
%else
Requires(post):   /usr/sbin/update-alternatives
Requires(postun): /usr/sbin/update-alternatives
%endif

%description
Parallax SSH provides an interface to executing commands on multiple
nodes at once using SSH. It also provides commands for sending and receiving files to
multiple nodes using SCP.

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

%build
python setup.py build

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

# create a dummy target for /etc/alternatives/parallax-askpass
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
mv %{buildroot}%{_bindir}/parallax-askpass %{buildroot}%{_bindir}/parallax-askpass-%{py_ver}
ln -s -f %{_sysconfdir}/alternatives/parallax-askpass %{buildroot}%{_bindir}/parallax-askpass

%post
%_sbindir/update-alternatives \
   --install %{_bindir}/parallax-askpass parallax-askpass %{_bindir}/parallax-askpass-%{py_ver} 20

%preun
if [ "$1" = 0 ] ; then
   %_sbindir/update-alternatives --remove parallax-askpass %{_bindir}/parallax-askpass-%{py_ver}
fi

%files
%defattr(-,root,root,-)
%doc AUTHORS README.md COPYING
%{python_sitelib}/parallax
%{python_sitelib}/parallax-%{version}*.egg-info
%{_bindir}/parallax-askpass
%{_bindir}/parallax-askpass-%{py_ver}
%ghost %_sysconfdir/alternatives/parallax-askpass

%changelog
openSUSE Build Service is sponsored by