%global modname argcomplete
%global _description \
Argcomplete provides easy, extensible command line tab completion of\
arguments for your Python script.\
\
It makes two assumptions:\
\
 * You are using bash as your shell\
 * You are using argparse to manage your command line arguments/options\
\
Argcomplete is particularly useful if your program has lots of\
options or subparsers, and if your program can dynamically suggest\
completions for your argument/option values (for example, if the user\
is browsing resources over the network).

Name:           python-%{modname}
Summary:        Bash tab completion for argparse
Version:        1.7.0
Release:        4%{?dist}
License:        ASL 2.0
URL:            https://github.com/kislyuk/argcomplete
Source0:        %{url}/archive/v%{version}/%{modname}-%{version}.tar.gz
BuildArch:      noarch


%description
%{_description}


%package -n python2-%{modname}
Summary:        %{summary}
%{?python_provide:%python_provide python2-%{modname}}
BuildRequires:  python2-devel
BuildRequires:  python-setuptools
Requires:       python-setuptools
%description -n python2-%{modname}
%{_description}
Python 2 version.


%package -n python3-%{modname}
Summary:        %{summary}
%{?python_provide:%python_provide python3-%{modname}}
BuildRequires:  python%{python3_pkgversion}-devel
BuildRequires:  python%{python3_pkgversion}-setuptools
%description -n python3-%{modname}
%{_description}
Python 3 version.


%prep
%autosetup -n %{modname}-%{version}

%build
%{__python3} setup.py build
%{__python2} setup.py build


%install
%{__python3} setup.py install --optimize=2 --root=%{buildroot}
%{__python2} setup.py install --optimize=2 --root=%{buildroot}
mkdir -p %{buildroot}%{_sysconfdir}/bash_completion.d/
install -p -m0644 %{buildroot}%{python2_sitelib}/%{modname}/bash_completion.d/python-argcomplete.sh %{buildroot}%{_sysconfdir}/bash_completion.d/


%files -n python2-%{modname}
%license LICENSE.rst
%doc README.rst
%{python2_sitelib}/%{modname}-*.egg-info/
%{python2_sitelib}/%{modname}/
%{_bindir}/activate-global-python-argcomplete
%{_bindir}/python-argcomplete-check-easy-install-script
%{_bindir}/python-argcomplete-tcsh
%{_bindir}/register-python-argcomplete
%{_sysconfdir}/bash_completion.d/python-argcomplete.sh


%files -n python3-%{modname}
%license LICENSE.rst
%doc README.rst
%{python3_sitelib}/%{modname}-*.egg-info/
%{python3_sitelib}/%{modname}/


%changelog