File python-doit.spec of Package python-doit

#
# spec file for package python-doit
#
# Copyright (c) 2018 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/
#


%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define         skip_python2 1
%define         oldpython python
Name:           python-doit
Version:        0.31.1
Release:        0
Url:            http://pydoit.org/
Summary:        Python Automation Tool
License:        MIT
Group:          Development/Languages/Python
Source0:        http://pypi.python.org/packages/source/d/doit/doit-%{version}.tar.gz
BuildRequires:  %{python_module dbm}
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module setuptools}
BuildRequires:  bash
BuildRequires:  fdupes
BuildRequires:  help2man
BuildRequires:  python-rpm-macros
BuildRequires:  zsh
# SECTION test requirements
BuildRequires:  %{python_module cloudpickle}
BuildRequires:  %{python_module pyinotify}
BuildRequires:  %{python_module pytest}
# /SECTION
Requires:       python-cloudpickle
Requires:       python-dbm
Recommends:     python-pyinotify
BuildArch:      noarch
Requires(post):   update-alternatives
Requires(postun):  update-alternatives

%python_subpackages

%description
DoIt is a task management & automation tool.

DoIt comes from the idea of bringing the power of build-tools
to execute any kind of task.

DoIt is an open-source build-tool written in python.
It is specially suitable for building and managing custom work-flows where
there is no out-of-the-box solution available.

%package bash-completion
Summary:        BASH completion for doit
Group:          Development/Languages/Python
Requires:       %{name} = %{version}
Requires:       bash
Provides:       %{oldpython}-doit-bash-completion = %{version}
Conflicts:      otherproviders(python-doit-bash-completion)

%description bash-completion
This package provides BASH completion for python3-doit.
It will also provide BASH completion for python2-doit if installed.

%package zsh-completion
Summary:        ZSG completion for doit
Group:          Development/Languages/Python
Requires:       %{name} = %{version}
Requires:       zsh

%description zsh-completion
This package provides ZSH completion for python3-doit.
It will also provide ZSH completion for python2-doit if installed.

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

%build
%python_build

%install
%python_install

mkdir -p %{buildroot}%{_mandir}/man1/
export PYTHONPATH=%{buildroot}%{python3_sitelib}
help2man -o %{buildroot}%{_mandir}/man1/doit.1 %{buildroot}%{_bindir}/doit

# Install bash and zsh completion file:
mkdir -p %{buildroot}%{_sysconfdir}/bash_completion.d/ \
         %{buildroot}%{_sysconfdir}/zsh_completion.d/
install -Dm0644 bash_completion_doit %{buildroot}%{_sysconfdir}/bash_completion.d/doit-completion.sh
install -Dm0644 zsh_completion_doit %{buildroot}%{_sysconfdir}/zsh_completion.d/doit-completion.sh

%python_clone -a %{buildroot}%{_bindir}/doit
%python_clone -a %{buildroot}%{_mandir}/man1/doit.1

%python_expand %fdupes %{buildroot}%{$python_sitelib}

%post
%{python_install_alternative doit doit.1%{ext_man} }

%postun
%python_uninstall_alternative doit

%files %{python_files}
%defattr(-,root,root,-)
%doc CHANGES AUTHORS README.rst TODO.txt
%license LICENSE
%{python_sitelib}/*
%python_alternative %{_bindir}/doit
%python_alternative %{_mandir}/man1/doit.1%{ext_man}

%files %{python_files bash-completion}
%config %{_sysconfdir}/bash_completion.d/doit-completion.sh

%files %{python_files zsh-completion}
%config %{_sysconfdir}/zsh_completion.d/doit-completion.sh

%changelog
openSUSE Build Service is sponsored by