]>
Commit | Line | Data |
---|---|---|
985bbc54 ER |
1 | # |
2 | # Conditional build: | |
0ad3784c | 3 | %bcond_without doc # Sphinx documentation |
8c859701 | 4 | %bcond_with tests # unit tests |
985bbc54 | 5 | %bcond_without python2 # CPython 2.x module |
5b8a83ed | 6 | %bcond_with python3 # CPython 3.x module (built from python3-argcomplete.spec) |
985bbc54 ER |
7 | |
8 | %define module argcomplete | |
9 | %define egg_name argcomplete | |
10 | %define pypi_name argcomplete | |
11 | Summary: Bash tab completion for argparse | |
8c859701 | 12 | Summary(pl.UTF-8): Bashowe dopełnianie parametrów dla argparse |
985bbc54 | 13 | Name: python-%{pypi_name} |
288b6fa1 JB |
14 | # keep 1.12.x here for python2 support |
15 | Version: 1.12.3 | |
16 | Release: 1 | |
985bbc54 ER |
17 | License: Apache v2.0 |
18 | Group: Libraries/Python | |
8c859701 | 19 | #Source0Download: https://github.com/kislyuk/argcomplete/releases |
c2ac89bf | 20 | Source0: https://github.com/kislyuk/argcomplete/archive/v%{version}/%{pypi_name}-%{version}.tar.gz |
288b6fa1 | 21 | # Source0-md5: de46337e0189224a6efd46569526bad8 |
c2ac89bf | 22 | URL: https://github.com/kislyuk/argcomplete |
0ad3784c JB |
23 | %if %(locale -a | grep -q '^C\.utf8$'; echo $?) |
24 | BuildRequires: glibc-localedb-all | |
25 | %endif | |
8c859701 JB |
26 | %if %{with python2} |
27 | BuildRequires: python-devel >= 1:2.7 | |
28 | BuildRequires: python-setuptools | |
29 | %if %{with tests} | |
30 | BuildRequires: python-importlib_metadata >= 0.23 | |
288b6fa1 | 31 | BuildRequires: python-importlib_metadata < 5 |
8c859701 JB |
32 | BuildRequires: python-pexpect |
33 | %endif | |
34 | %endif | |
1e3cd944 | 35 | %if %{with python3} |
8c859701 | 36 | BuildRequires: python3-devel >= 1:3.5 |
1e3cd944 | 37 | BuildRequires: python3-setuptools |
8c859701 JB |
38 | %if %{with tests} |
39 | %if "%{py3_ver}" < "3.8" | |
40 | BuildRequires: python3-importlib_metadata >= 0.23 | |
288b6fa1 | 41 | BuildRequires: python3-importlib_metadata < 5 |
8c859701 JB |
42 | %endif |
43 | BuildRequires: python3-pexpect | |
44 | %endif | |
1e3cd944 | 45 | %endif |
8c859701 JB |
46 | BuildRequires: rpm-pythonprov |
47 | BuildRequires: rpmbuild(macros) >= 1.714 | |
0ad3784c JB |
48 | %if %{with doc} |
49 | BuildRequires: python3-guzzle_sphinx_theme | |
50 | BuildRequires: sphinx-pdg-3 | |
51 | %endif | |
1e3cd944 JR |
52 | %if %{with tests} |
53 | BuildRequires: bash | |
0ad3784c JB |
54 | BuildRequires: fish |
55 | BuildRequires: pip | |
985bbc54 | 56 | BuildRequires: tcsh |
1e3cd944 | 57 | %endif |
8c859701 JB |
58 | %if %{without python3} |
59 | # pkg_resources module is used from python-argcomplete-check-easy-install-script | |
60 | Requires: python-setuptools | |
985bbc54 ER |
61 | %endif |
62 | BuildArch: noarch | |
c2ac89bf ER |
63 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
64 | ||
65 | %description | |
66 | Argcomplete provides easy, extensible command line tab completion of | |
67 | arguments for your Python script. | |
68 | ||
69 | It makes two assumptions: | |
8c859701 JB |
70 | - You are using bash as your shell |
71 | - You are using argparse to manage your command line arguments/options | |
985bbc54 | 72 | |
c2ac89bf ER |
73 | Argcomplete is particularly useful if your program has lots of options |
74 | or subparsers, and if your program can dynamically suggest completions | |
75 | for your argument/option values (for example, if the user is browsing | |
76 | resources over the network). | |
985bbc54 | 77 | |
8c859701 JB |
78 | %description -l pl.UTF-8 |
79 | Argcomplete zapewnia łatwe, rozszerzalne dopełnianie tabem argumentów | |
80 | scriptów Pythona w wierszu poleceń. | |
81 | ||
82 | Czyni dwa założenia: | |
83 | - powłoką jest bash | |
84 | - skrypt używa argparse do zarządzania argumentami/opcjami linii | |
85 | poleceń | |
86 | ||
87 | Argcomplete jest przydatne szczególnie wtedy, gdy program ma wiele | |
88 | opcji lub podparserów, albo gdy może dynamicznie podpowiadać | |
89 | dopełnienia wartości argumentów/opcji (np. kiedy użytkownik przegląda | |
90 | zasoby sieciowe). | |
91 | ||
985bbc54 | 92 | %package -n python3-%{pypi_name} |
8c859701 JB |
93 | Summary: Bash tab completion for argparse |
94 | Summary(pl.UTF-8): Bashowe dopełnianie parametrów dla argparse | |
985bbc54 | 95 | Group: Libraries/Python |
985bbc54 ER |
96 | # pkg_resources module is used from python-argcomplete-check-easy-install-script |
97 | Requires: python3-setuptools | |
98 | ||
c2ac89bf ER |
99 | %description -n python3-%{pypi_name} |
100 | Argcomplete provides easy, extensible command line tab completion of | |
101 | arguments for your Python script. | |
102 | ||
103 | It makes two assumptions: | |
8c859701 JB |
104 | - You are using bash as your shell |
105 | - You are using argparse to manage your command line arguments/options | |
c2ac89bf ER |
106 | |
107 | Argcomplete is particularly useful if your program has lots of options | |
108 | or subparsers, and if your program can dynamically suggest completions | |
109 | for your argument/option values (for example, if the user is browsing | |
110 | resources over the network). | |
985bbc54 | 111 | |
8c859701 JB |
112 | %description -n python3-%{pypi_name} -l pl.UTF-8 |
113 | Argcomplete zapewnia łatwe, rozszerzalne dopełnianie tabem argumentów | |
114 | scriptów Pythona w wierszu poleceń. | |
115 | ||
116 | Czyni dwa założenia: | |
117 | - powłoką jest bash | |
118 | - skrypt używa argparse do zarządzania argumentami/opcjami linii | |
119 | poleceń | |
120 | ||
121 | Argcomplete jest przydatne szczególnie wtedy, gdy program ma wiele | |
122 | opcji lub podparserów, albo gdy może dynamicznie podpowiadać | |
123 | dopełnienia wartości argumentów/opcji (np. kiedy użytkownik przegląda | |
124 | zasoby sieciowe). | |
125 | ||
126 | %package -n bash-completion-python-argcomplete | |
127 | Summary: Bash completion for argparse | |
128 | Summary(pl.UTF-8): Bashowe dopełnianie parametrów dla argparse | |
129 | Group: Applications/Shells | |
130 | Requires: bash-completion >= 2.0 | |
131 | Suggests: %{name} = %{version}-%{release} | |
132 | Suggests: python3-%{pypi_name} = %{version}-%{release} | |
133 | ||
134 | %description -n bash-completion-python-argcomplete | |
135 | Bash completion for argparse based Python scripts. | |
136 | ||
137 | %description -n bash-completion-python-argcomplete -l pl.UTF-8 | |
138 | Bashowe dopełnianie parametrów dla skryptów Pythona opartych na | |
139 | argparse. | |
140 | ||
985bbc54 ER |
141 | %prep |
142 | %setup -q -n %{pypi_name}-%{version} | |
143 | ||
0ad3784c JB |
144 | %package apidocs |
145 | Summary: API documentation for Python argcomplete module | |
146 | Summary(pl.UTF-8): Dokumentacja API modułu Pythona argcomplete | |
147 | Group: Documentation | |
148 | ||
149 | %description apidocs | |
150 | API documentation for Python argcomplete module. | |
151 | ||
152 | %description apidocs -l pl.UTF-8 | |
153 | Dokumentacja API modułu Pythona argcomplete. | |
985bbc54 ER |
154 | |
155 | %build | |
156 | export LC_ALL=C.UTF-8 | |
157 | %if %{with python2} | |
8c859701 | 158 | %py_build |
8c859701 JB |
159 | |
160 | %if %{with tests} | |
161 | %{__python} test/test.py | |
162 | %endif | |
985bbc54 ER |
163 | %endif |
164 | ||
165 | %if %{with python3} | |
8c859701 | 166 | %py3_build |
8c859701 JB |
167 | |
168 | %if %{with tests} | |
169 | %{__python3} test/test.py | |
170 | %endif | |
985bbc54 ER |
171 | %endif |
172 | ||
0ad3784c JB |
173 | %if %{with doc} |
174 | sphinx-build-3 -b html docs docs/_build/html | |
175 | %endif | |
176 | ||
985bbc54 ER |
177 | %install |
178 | rm -rf $RPM_BUILD_ROOT | |
179 | %if %{with python2} | |
180 | %py_install | |
8c859701 | 181 | |
985bbc54 ER |
182 | %py_postclean |
183 | %endif | |
184 | ||
185 | %if %{with python3} | |
8c859701 | 186 | %{__rm} -r $RPM_BUILD_ROOT%{_bindir} |
985bbc54 ER |
187 | %py3_install |
188 | %endif | |
189 | ||
190 | install -d $RPM_BUILD_ROOT%{bash_compdir} | |
8c859701 | 191 | cp -p argcomplete/bash_completion.d/python-argcomplete $RPM_BUILD_ROOT%{bash_compdir} |
985bbc54 ER |
192 | |
193 | %clean | |
194 | rm -rf $RPM_BUILD_ROOT | |
195 | ||
196 | %if %{with python2} | |
197 | %files | |
198 | %defattr(644,root,root,755) | |
8c859701 | 199 | %doc Authors.rst Changes.rst README.rst |
935ce037 JR |
200 | %if %{without python3} |
201 | %attr(755,root,root) %{_bindir}/activate-global-python-argcomplete | |
202 | %attr(755,root,root) %{_bindir}/python-argcomplete-check-easy-install-script | |
203 | %attr(755,root,root) %{_bindir}/python-argcomplete-tcsh | |
204 | %attr(755,root,root) %{_bindir}/register-python-argcomplete | |
205 | %endif | |
985bbc54 ER |
206 | %{py_sitescriptdir}/%{module} |
207 | %{py_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info | |
208 | %endif | |
209 | ||
210 | %if %{with python3} | |
211 | %files -n python3-%{pypi_name} | |
212 | %defattr(644,root,root,755) | |
8c859701 | 213 | %doc Authors.rst Changes.rst README.rst |
985bbc54 ER |
214 | %attr(755,root,root) %{_bindir}/activate-global-python-argcomplete |
215 | %attr(755,root,root) %{_bindir}/python-argcomplete-check-easy-install-script | |
216 | %attr(755,root,root) %{_bindir}/python-argcomplete-tcsh | |
217 | %attr(755,root,root) %{_bindir}/register-python-argcomplete | |
218 | %{py3_sitescriptdir}/%{module} | |
219 | %{py3_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info | |
985bbc54 | 220 | %endif |
8c859701 JB |
221 | |
222 | %files -n bash-completion-python-argcomplete | |
223 | %defattr(644,root,root,755) | |
224 | %{bash_compdir}/python-argcomplete | |
0ad3784c JB |
225 | |
226 | %if %{with doc} | |
227 | %files apidocs | |
228 | %defattr(644,root,root,755) | |
229 | %doc docs/_build/html/{_static,*.html,*.js} | |
230 | %endif |