%global modname argcomplete # Currently it's broken: https://github.com/kislyuk/argcomplete/issues/174 %bcond_with check Name: python-%{modname} Summary: Bash tab completion for argparse Version: 1.9.2 Release: %mkrel 2 Group: Development/Python License: ASL 2.0 URL: https://github.com/kislyuk/argcomplete Source0: %{url}/archive/v%{version}/%{modname}-%{version}.tar.gz BuildRequires: pkgconfig(python2) BuildRequires: pythonegg(2)(setuptools) %if %{with check} BuildRequires: pythonegg(2)(pexpect) BuildRequires: tcsh %endif BuildArch: noarch %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). %description %{_description} Python 2 version. %package -n python3-%{modname} Summary: %{summary} Group: Development/Python BuildRequires: pkgconfig(python3) BuildRequires: pythonegg(3)(setuptools) %if %{with check} BuildRequires: pythonegg(3)(pexpect) BuildRequires: tcsh %endif # pkg_resources module is used from python-argcomplete-check-easy-install-script Requires: pythonegg(3)(setuptools) %description -n python3-%{modname} %{_description} Python 3 version. %prep %autosetup -n %{modname}-%{version} # Remove useless BRs sed -i -r -e '/tests_require = /s/"(coverage|flake8|wheel)"[, ]*//g' setup.py %build %py2_build %py3_build %install %py2_install %py3_install mkdir -p %{buildroot}%{_sysconfdir}/bash_completion.d/ install -p -m0644 %{buildroot}%{python3_sitelib}/%{modname}/bash_completion.d/python-argcomplete.sh %{buildroot}%{_sysconfdir}/bash_completion.d/ %if %{with check} %check export LC_ALL=C.UTF-8 %{__python2} setup.py test %{__python3} setup.py test %endif %files %license LICENSE.rst %doc README.rst %{python2_sitelib}/%{modname}-*.egg-info/ %{python2_sitelib}/%{modname}/ %files -n python3-%{modname} %license LICENSE.rst %doc README.rst %{python3_sitelib}/%{modname}-*.egg-info/ %{python3_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