3 %bcond_with tests # do not perform "make test"
4 %bcond_without python2 # CPython 2.x module
5 %bcond_without python3 # CPython 3.x module
7 %define module argcomplete
8 %define egg_name argcomplete
9 %define pypi_name argcomplete
10 Summary: Bash tab completion for argparse
11 Name: python-%{pypi_name}
15 Group: Libraries/Python
16 Source0: https://github.com/kislyuk/argcomplete/archive/v%{version}/%{pypi_name}-%{version}.tar.gz
17 # Source0-md5: 18afda95a2726eb24df810645bef4b38
18 URL: https://github.com/kislyuk/argcomplete
19 BuildRequires: rpm-pythonprov
20 BuildRequires: rpmbuild(macros) >= 1.714
22 BuildRequires: python3-devel
23 BuildRequires: python3-setuptools
29 BuildRequires: python3-pexpect
33 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
36 Argcomplete provides easy, extensible command line tab completion of
37 arguments for your Python script.
39 It makes two assumptions:
41 - You are using bash as your shell
42 - You are using argparse to manage your command line arguments/options
44 Argcomplete is particularly useful if your program has lots of options
45 or subparsers, and if your program can dynamically suggest completions
46 for your argument/option values (for example, if the user is browsing
47 resources over the network).
49 %package -n python3-%{pypi_name}
51 Group: Libraries/Python
52 # pkg_resources module is used from python-argcomplete-check-easy-install-script
53 Requires: python3-setuptools
55 %description -n python3-%{pypi_name}
56 Argcomplete provides easy, extensible command line tab completion of
57 arguments for your Python script.
59 It makes two assumptions:
61 - You are using bash as your shell
62 - You are using argparse to manage your command line arguments/options
64 Argcomplete is particularly useful if your program has lots of options
65 or subparsers, and if your program can dynamically suggest completions
66 for your argument/option values (for example, if the user is browsing
67 resources over the network).
70 %setup -q -n %{pypi_name}-%{version}
73 sed -i -r -e '/tests_require = /s/"(coverage|flake8|wheel)"[, ]*//g' setup.py
78 %py_build %{?with_tests:test}
82 %py3_build %{?with_tests:test}
86 rm -rf $RPM_BUILD_ROOT
96 install -d $RPM_BUILD_ROOT%{bash_compdir}
97 install -p $RPM_BUILD_ROOT%{py3_sitescriptdir}/%{pypi_name}/bash_completion.d/python-argcomplete.sh \
98 $RPM_BUILD_ROOT%{bash_compdir}
101 rm -rf $RPM_BUILD_ROOT
105 %defattr(644,root,root,755)
106 %doc README.rst LICENSE.rst
107 %{py_sitescriptdir}/%{module}
108 %{py_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info
112 %files -n python3-%{pypi_name}
113 %defattr(644,root,root,755)
114 %doc README.rst LICENSE.rst
115 %attr(755,root,root) %{_bindir}/activate-global-python-argcomplete
116 %attr(755,root,root) %{_bindir}/python-argcomplete-check-easy-install-script
117 %attr(755,root,root) %{_bindir}/python-argcomplete-tcsh
118 %attr(755,root,root) %{_bindir}/register-python-argcomplete
119 %{py3_sitescriptdir}/%{module}
120 %{py3_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info
121 %{bash_compdir}/python-argcomplete.sh