]>
Commit | Line | Data |
---|---|---|
985bbc54 ER |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without tests # do not perform "make test" | |
4 | %bcond_without python2 # CPython 2.x module | |
5 | %bcond_without python3 # CPython 3.x module | |
6 | ||
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} | |
12 | Version: 1.9.3 | |
13 | Release: 1 | |
14 | License: Apache v2.0 | |
15 | Group: Libraries/Python | |
c2ac89bf | 16 | Source0: https://github.com/kislyuk/argcomplete/archive/v%{version}/%{pypi_name}-%{version}.tar.gz |
985bbc54 | 17 | # Source0-md5: 18afda95a2726eb24df810645bef4b38 |
c2ac89bf | 18 | URL: https://github.com/kislyuk/argcomplete |
985bbc54 ER |
19 | BuildRequires: rpm-pythonprov |
20 | BuildRequires: rpmbuild(macros) >= 1.714 | |
1e3cd944 JR |
21 | %if %{with python3} |
22 | BuildRequires: python3-devel | |
23 | BuildRequires: python3-setuptools | |
24 | %endif | |
25 | %if %{with tests} | |
26 | BuildRequires: bash | |
985bbc54 | 27 | BuildRequires: tcsh |
1e3cd944 JR |
28 | %if %{with python3} |
29 | BuildRequires: python3-pexpect | |
30 | %endif | |
985bbc54 ER |
31 | %endif |
32 | BuildArch: noarch | |
c2ac89bf ER |
33 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
34 | ||
35 | %description | |
36 | Argcomplete provides easy, extensible command line tab completion of | |
37 | arguments for your Python script. | |
38 | ||
39 | It makes two assumptions: | |
985bbc54 | 40 | |
c2ac89bf ER |
41 | - You are using bash as your shell |
42 | - You are using argparse to manage your command line arguments/options | |
985bbc54 | 43 | |
c2ac89bf ER |
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). | |
985bbc54 ER |
48 | |
49 | %package -n python3-%{pypi_name} | |
50 | Summary: %{summary} | |
51 | Group: Libraries/Python | |
985bbc54 ER |
52 | # pkg_resources module is used from python-argcomplete-check-easy-install-script |
53 | Requires: python3-setuptools | |
54 | ||
c2ac89bf ER |
55 | %description -n python3-%{pypi_name} |
56 | Argcomplete provides easy, extensible command line tab completion of | |
57 | arguments for your Python script. | |
58 | ||
59 | It makes two assumptions: | |
60 | ||
61 | - You are using bash as your shell | |
62 | - You are using argparse to manage your command line arguments/options | |
63 | ||
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). | |
985bbc54 ER |
68 | |
69 | %prep | |
70 | %setup -q -n %{pypi_name}-%{version} | |
71 | ||
72 | # Remove useless BRs | |
73 | sed -i -r -e '/tests_require = /s/"(coverage|flake8|wheel)"[, ]*//g' setup.py | |
74 | ||
75 | %build | |
76 | export LC_ALL=C.UTF-8 | |
77 | %if %{with python2} | |
78 | %py_build %{?with_tests:test} | |
79 | %endif | |
80 | ||
81 | %if %{with python3} | |
82 | %py3_build %{?with_tests:test} | |
83 | %endif | |
84 | ||
85 | %install | |
86 | rm -rf $RPM_BUILD_ROOT | |
87 | %if %{with python2} | |
88 | %py_install | |
89 | %py_postclean | |
90 | %endif | |
91 | ||
92 | %if %{with python3} | |
93 | %py3_install | |
94 | %endif | |
95 | ||
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} | |
99 | ||
100 | %clean | |
101 | rm -rf $RPM_BUILD_ROOT | |
102 | ||
103 | %if %{with python2} | |
104 | %files | |
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 | |
109 | %endif | |
110 | ||
111 | %if %{with python3} | |
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 | |
122 | %endif |